compute: Add --password option for openstack server create

Change-Id: Iaf923200efe023655a58ac5acac0b087d2fd5366
Story: #1708570
Task: #13780
This commit is contained in:
Zhaokun Fu 2017-08-03 19:51:27 -07:00 committed by Stephen Finucane
parent a48c05b90a
commit fd9a235de3
3 changed files with 36 additions and 0 deletions

View File

@ -555,6 +555,11 @@ class CreateServer(command.ShowOne):
'duplicate mapping using --block-device-mapping for this '
'volume.'),
)
parser.add_argument(
'--password',
metavar='<password>',
help=_("Set the password to this server"),
)
parser.add_argument(
'--flavor',
metavar='<flavor>',
@ -1054,6 +1059,7 @@ class CreateServer(command.ShowOne):
userdata=userdata,
key_name=parsed_args.key_name,
availability_zone=parsed_args.availability_zone,
admin_pass=parsed_args.password,
block_device_mapping_v2=block_device_mapping_v2,
nics=nics,
scheduler_hints=hints,

View File

@ -831,6 +831,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics=[],
scheduler_hints={},
@ -857,6 +858,7 @@ class TestServerCreate(TestServer):
'--property', 'Beta=b',
'--security-group', 'securitygroup',
'--use-config-drive',
'--password', 'passw0rd',
'--hint', 'a=b',
'--hint', 'a=c',
self.new_server.name,
@ -869,6 +871,7 @@ class TestServerCreate(TestServer):
('security_group', ['securitygroup']),
('hint', {'a': ['b', 'c']}),
('config_drive', True),
('password', 'passw0rd'),
('server_name', self.new_server.name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -897,6 +900,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name='keyname',
availability_zone=None,
admin_pass='passw0rd',
block_device_mapping_v2=[],
nics=[],
scheduler_hints={'a': ['b', 'c']},
@ -983,6 +987,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name='keyname',
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics=[],
scheduler_hints={},
@ -1069,6 +1074,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics=[{'net-id': 'net1_uuid',
'v4-fixed-ip': '',
@ -1133,6 +1139,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='auto',
scheduler_hints={},
@ -1182,6 +1189,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='auto',
scheduler_hints={},
@ -1227,6 +1235,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='none',
scheduler_hints={},
@ -1392,6 +1401,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics=[],
scheduler_hints={},
@ -1442,6 +1452,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics=[],
scheduler_hints={},
@ -1497,6 +1508,7 @@ class TestServerCreate(TestServer):
userdata=mock_file,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics=[],
scheduler_hints={},
@ -1543,6 +1555,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[{
'device_name': 'vda',
'uuid': self.volume.id,
@ -1595,6 +1608,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[{
'device_name': 'vdf',
'uuid': self.volume.id,
@ -1646,6 +1660,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[{
'device_name': 'vdf',
'uuid': self.volume.id,
@ -1699,6 +1714,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[{
'device_name': 'vde',
'uuid': self.volume.id,
@ -1754,6 +1770,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[{
'device_name': 'vds',
'uuid': self.snapshot.id,
@ -1809,6 +1826,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[
{
'device_name': 'vdb',
@ -1945,6 +1963,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='none',
meta=None,
@ -2000,6 +2019,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='none',
meta=None,
@ -2089,6 +2109,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='none',
meta=None,
@ -2169,6 +2190,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='auto',
scheduler_hints={},
@ -2253,6 +2275,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='auto',
scheduler_hints={},
@ -2338,6 +2361,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='auto',
scheduler_hints={},
@ -2425,6 +2449,7 @@ class TestServerCreate(TestServer):
userdata=None,
key_name=None,
availability_zone=None,
admin_pass=None,
block_device_mapping_v2=[],
nics='auto',
scheduler_hints={},

View File

@ -0,0 +1,5 @@
---
features:
- |
Add ``--password`` option to ``server create`` command, allowing users to
set the admin password when creating a new instance.