2018年5月9日 星期三

[OpenStack][Cellv2] Nova Cellv2的建置指令


Cellv2的部署模式

Single Cell


Multiple Cells




一般來說,要建置nova cell會經過以下程序
nova-manage db sync 
nova-manage api_db sync
nova-manage db online_data_migrations
nova-manage cell_v2 map_cell0  # 建立cell0環境資訊
nova-manage cell_v2 create_cell # 建立cell mapping
nova-manage cell_v2 discover_hosts # discover compute node

(註: 可參考kolla的作法: https://github.com/openstack/kolla-ansible/blob/92dd118128258e0fa5dadb3ef8297407b36cc00b/ansible/roles/nova/tasks/simple_cell_setup.yml )

當我們執行nova-manage cellv2 map_cell0,它其實會執行以下函式:

def _map_cell0(self, database_connection=None):
        """Faciliate creation of a cell mapping for cell0.
        See map_cell0 for more.
        """
        def cell0_default_connection():
            # If no database connection is provided one is generated
            # based on the database connection url.
            # The cell0 database will use the same database scheme and
            # netloc as the main database, with a related path.
            # NOTE(sbauza): The URL has to be RFC1738 compliant in order to
            # be usable by sqlalchemy.
            connection = CONF.database.connection
            # sqlalchemy has a nice utility for parsing database connection
            # URLs so we use that here to get the db name so we don't have to
            # worry about parsing and splitting a URL which could have special
            # characters in the password, which makes parsing a nightmare.
            url = sqla_url.make_url(connection)
            url.database = url.database + '_cell0'
            return urlparse.unquote(str(url))

        dbc = database_connection or cell0_default_connection()
        ctxt = context.RequestContext()
        # A transport url of 'none://' is provided for cell0. RPC should not
        # be used to access cell0 objects. Cells transport switching will
        # ignore any 'none' transport type.
        cell_mapping = objects.CellMapping(
                ctxt, uuid=objects.CellMapping.CELL0_UUID, name="cell0",
                transport_url="none:///",
                database_connection=dbc)
        cell_mapping.create()
        return cell_mapping


https://github.com/openstack/nova/blob/09af976016a83288df22ac6ed1cce1676c2294cc/nova/cmd/manage.py#L1051

透過nova-manage cell_v2 list_cells指令可以發現,它其實會建立出底下cell0的連線資訊

  • 再來執行nova-manage cell_v2 discover_hosts --verbose,它會去探勘compute nodes來建立mapping





[建置過程可能遇到的問題]

1. WARNING: cell0 mapping not found - not syncing cell0
  可以先確認自己的db是否都已經建立好,然後是否已經sync了
https://github.com/openstack/nova/blob/09af976016a83288df22ac6ed1cce1676c2294cc/nova/cmd/manage.py#L455

沒有留言:

張貼留言