Merge "Add disabled option to create_cell command"
This commit is contained in:
commit
9c7ebf90fa
@ -187,7 +187,7 @@ Nova Cells v2
|
||||
instance which has instance mapping, and 4 if it is an archived instance
|
||||
which still has an instance mapping.
|
||||
|
||||
``nova-manage cell_v2 create_cell [--name <cell_name>] [--transport-url <transport_url>] [--database_connection <database_connection>] [--verbose]``
|
||||
``nova-manage cell_v2 create_cell [--name <cell_name>] [--transport-url <transport_url>] [--database_connection <database_connection>] [--verbose] [--disabled]``
|
||||
Create a cell mapping to the database connection and message queue
|
||||
transport url. If a database_connection is not specified, it will use the
|
||||
one defined by ``[database]/connection`` in the configuration file passed
|
||||
@ -196,7 +196,9 @@ Nova Cells v2
|
||||
verbose option will print out the resulting cell mapping uuid. Returns 0
|
||||
if the cell mapping was successfully created, 1 if the transport url or
|
||||
database connection was missing, and 2 if a cell is already using that
|
||||
transport url and database connection combination.
|
||||
transport url and database connection combination. All the cells created are
|
||||
by default enabled. However passing the disabled option can create a pre-disabled
|
||||
cell, meaning no scheduling will happen to this cell.
|
||||
|
||||
``nova-manage cell_v2 discover_hosts [--cell_uuid <cell_uuid>] [--verbose] [--strict] [--by-service]``
|
||||
Searches cells, or a single cell, and maps found hosts. This command will
|
||||
|
@ -1383,8 +1383,10 @@ class CellV2Commands(object):
|
||||
help=_('The transport url for the cell message queue'))
|
||||
@args('--verbose', action='store_true',
|
||||
help=_('Output the uuid of the created cell'))
|
||||
@args('--disabled', action='store_true',
|
||||
help=_('To create a pre-disabled cell.'))
|
||||
def create_cell(self, name=None, database_connection=None,
|
||||
transport_url=None, verbose=False):
|
||||
transport_url=None, verbose=False, disabled=False):
|
||||
ctxt = context.get_context()
|
||||
transport_url = transport_url or CONF.transport_url
|
||||
if not transport_url:
|
||||
@ -1405,7 +1407,8 @@ class CellV2Commands(object):
|
||||
ctxt,
|
||||
uuid=cell_mapping_uuid, name=name,
|
||||
transport_url=transport_url,
|
||||
database_connection=database_connection)
|
||||
database_connection=database_connection,
|
||||
disabled=disabled)
|
||||
cell_mapping.create()
|
||||
if verbose:
|
||||
print(cell_mapping_uuid)
|
||||
|
@ -1711,6 +1711,7 @@ class CellV2CommandsTestCase(test.NoDBTestCase):
|
||||
self.assertEqual(kwargs['database_connection'],
|
||||
cell2.database_connection)
|
||||
self.assertEqual(kwargs['transport_url'], cell2.transport_url)
|
||||
self.assertIs(cell2.disabled, False)
|
||||
|
||||
def test_create_cell_use_config_values(self):
|
||||
settings = dict(
|
||||
@ -1752,6 +1753,20 @@ class CellV2CommandsTestCase(test.NoDBTestCase):
|
||||
self.assertEqual(1, status)
|
||||
self.assertIn('--database_connection', self.output.getvalue())
|
||||
|
||||
def test_create_cell_pre_disabled(self):
|
||||
ctxt = context.get_context()
|
||||
kwargs = dict(
|
||||
name='fake-name1',
|
||||
transport_url='fake-transport-url1',
|
||||
database_connection='fake-db-connection1')
|
||||
status1 = self.commands.create_cell(verbose=True, disabled=True,
|
||||
**kwargs)
|
||||
self.assertEqual(0, status1)
|
||||
cell_uuid1 = self.output.getvalue().strip()
|
||||
cell1 = objects.CellMapping.get_by_uuid(ctxt, cell_uuid1)
|
||||
self.assertEqual(kwargs['name'], cell1.name)
|
||||
self.assertIs(cell1.disabled, True)
|
||||
|
||||
def test_list_cells_no_cells_verbose_false(self):
|
||||
ctxt = context.RequestContext()
|
||||
cell_mapping0 = objects.CellMapping(
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new option ``disabled`` has been added to nova-manage cell_v2 create_cell
|
||||
command by which users can create pre-disabled cells. Hence unless such cells
|
||||
are enabled, no VMs will be spawned on the hosts in these cells.
|
Loading…
Reference in New Issue
Block a user