Merge "Add 'openstack server create --use-config-drive'"
This commit is contained in:
commit
960004dcc7
openstackclient
releasenotes/notes
@ -707,12 +707,30 @@ class CreateServer(command.ShowOne):
|
|||||||
default={},
|
default={},
|
||||||
help=_('Hints for the scheduler (optional extension)'),
|
help=_('Hints for the scheduler (optional extension)'),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
config_drive_group = parser.add_mutually_exclusive_group()
|
||||||
|
config_drive_group.add_argument(
|
||||||
|
'--use-config-drive',
|
||||||
|
action='store_true',
|
||||||
|
dest='config_drive',
|
||||||
|
help=_("Enable config drive."),
|
||||||
|
)
|
||||||
|
config_drive_group.add_argument(
|
||||||
|
'--no-config-drive',
|
||||||
|
action='store_false',
|
||||||
|
dest='config_drive',
|
||||||
|
help=_("Disable config drive."),
|
||||||
|
)
|
||||||
|
# TODO(stephenfin): Drop support in the next major version bump after
|
||||||
|
# Victoria
|
||||||
|
config_drive_group.add_argument(
|
||||||
'--config-drive',
|
'--config-drive',
|
||||||
metavar='<config-drive-volume>|True',
|
metavar='<config-drive-volume>|True',
|
||||||
default=False,
|
default=False,
|
||||||
help=_('Use specified volume as the config drive, '
|
help=_(
|
||||||
'or \'True\' to use an ephemeral drive'),
|
"**Deprecated** Use specified volume as the config drive, "
|
||||||
|
"or 'True' to use an ephemeral drive. Replaced by "
|
||||||
|
"'--use-config-drive'."
|
||||||
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--min',
|
'--min',
|
||||||
@ -1013,16 +1031,19 @@ class CreateServer(command.ShowOne):
|
|||||||
else:
|
else:
|
||||||
hints[key] = values
|
hints[key] = values
|
||||||
|
|
||||||
# What does a non-boolean value for config-drive do?
|
if isinstance(parsed_args.config_drive, bool):
|
||||||
# --config-drive argument is either a volume id or
|
# NOTE(stephenfin): The API doesn't accept False as a value :'(
|
||||||
# 'True' (or '1') to use an ephemeral volume
|
config_drive = parsed_args.config_drive or None
|
||||||
if str(parsed_args.config_drive).lower() in ("true", "1"):
|
|
||||||
config_drive = True
|
|
||||||
elif str(parsed_args.config_drive).lower() in ("false", "0",
|
|
||||||
"", "none"):
|
|
||||||
config_drive = None
|
|
||||||
else:
|
else:
|
||||||
config_drive = parsed_args.config_drive
|
# TODO(stephenfin): Remove when we drop support for
|
||||||
|
# '--config-drive'
|
||||||
|
if str(parsed_args.config_drive).lower() in ("true", "1"):
|
||||||
|
config_drive = True
|
||||||
|
elif str(parsed_args.config_drive).lower() in ("false", "0",
|
||||||
|
"", "none"):
|
||||||
|
config_drive = None
|
||||||
|
else:
|
||||||
|
config_drive = parsed_args.config_drive
|
||||||
|
|
||||||
boot_kwargs = dict(
|
boot_kwargs = dict(
|
||||||
meta=parsed_args.property,
|
meta=parsed_args.property,
|
||||||
|
@ -857,6 +857,7 @@ class TestServerCreate(TestServer):
|
|||||||
'--key-name', 'keyname',
|
'--key-name', 'keyname',
|
||||||
'--property', 'Beta=b',
|
'--property', 'Beta=b',
|
||||||
'--security-group', 'securitygroup',
|
'--security-group', 'securitygroup',
|
||||||
|
'--use-config-drive',
|
||||||
'--hint', 'a=b',
|
'--hint', 'a=b',
|
||||||
'--hint', 'a=c',
|
'--hint', 'a=c',
|
||||||
self.new_server.name,
|
self.new_server.name,
|
||||||
@ -868,7 +869,7 @@ class TestServerCreate(TestServer):
|
|||||||
('property', {'Beta': 'b'}),
|
('property', {'Beta': 'b'}),
|
||||||
('security_group', ['securitygroup']),
|
('security_group', ['securitygroup']),
|
||||||
('hint', {'a': ['b', 'c']}),
|
('hint', {'a': ['b', 'c']}),
|
||||||
('config_drive', False),
|
('config_drive', True),
|
||||||
('server_name', self.new_server.name),
|
('server_name', self.new_server.name),
|
||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
@ -900,7 +901,7 @@ class TestServerCreate(TestServer):
|
|||||||
block_device_mapping_v2=[],
|
block_device_mapping_v2=[],
|
||||||
nics=[],
|
nics=[],
|
||||||
scheduler_hints={'a': ['b', 'c']},
|
scheduler_hints={'a': ['b', 'c']},
|
||||||
config_drive=None,
|
config_drive=True,
|
||||||
)
|
)
|
||||||
# ServerManager.create(name, image, flavor, **kwargs)
|
# ServerManager.create(name, image, flavor, **kwargs)
|
||||||
self.servers_mock.create.assert_called_with(
|
self.servers_mock.create.assert_called_with(
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
deprecations:
|
||||||
|
- |
|
||||||
|
The ``--config-drive`` option on the ``openstack server create`` command
|
||||||
|
has been deprecated in favour of the ``--use-config-drive`` and
|
||||||
|
``--no-config-drive`` arguments. The ``--config-drive`` option expected
|
||||||
|
either a string or bool-like argument, but the nova API has only supported
|
||||||
|
boolean values since API v2.1 was introduced.
|
Loading…
x
Reference in New Issue
Block a user