Fix 'config_drive' and 'networks' for compute server
The 'config_drive' property was missing fro the compute server class. This patch adds it. The 'networks' property is allowed to be specified as 'auto', 'none' or a list of network properties. It was forced to be a dict previously. This patch removes that constraint. Change-Id: I1d8673935a751d8a319eb711e9592c6ffd8929ef
This commit is contained in:
parent
d435684465
commit
2afffeaa77
|
@ -80,6 +80,9 @@ class Server(resource2.Resource, metadata.MetadataMixin):
|
|||
key_name = resource2.Body('key_name')
|
||||
#: The disk configuration. Either AUTO or MANUAL.
|
||||
disk_config = resource2.Body('OS-DCF:diskConfig')
|
||||
#: Indicates whether a configuration drive enables metadata injection.
|
||||
#: Not all cloud providers enable this feature.
|
||||
has_config_drive = resource2.Body('config_drive')
|
||||
#: The name of the availability zone this server is a part of.
|
||||
availability_zone = resource2.Body('OS-EXT-AZ:availability_zone')
|
||||
#: The power state of this server.
|
||||
|
@ -118,7 +121,7 @@ class Server(resource2.Resource, metadata.MetadataMixin):
|
|||
#: networks defined for the tenant. When you do not specify the
|
||||
#: networks parameter, the server attaches to the only network
|
||||
#: created for the current tenant.
|
||||
networks = resource2.Body('networks', type=dict)
|
||||
networks = resource2.Body('networks')
|
||||
|
||||
def _action(self, session, body):
|
||||
"""Preform server actions given the message body."""
|
||||
|
|
|
@ -20,6 +20,7 @@ EXAMPLE = {
|
|||
'accessIPv4': '1',
|
||||
'accessIPv6': '2',
|
||||
'addresses': {'region': '3'},
|
||||
'config_drive': True,
|
||||
'created': '2015-03-09T12:14:57.233772',
|
||||
'flavorRef': '5',
|
||||
'flavor': {'id': 'FLAVOR_ID', 'links': {}},
|
||||
|
@ -29,6 +30,7 @@ EXAMPLE = {
|
|||
'image': {'id': 'IMAGE_ID', 'links': {}},
|
||||
'links': '9',
|
||||
'metadata': {'key': '10'},
|
||||
'networks': 'auto',
|
||||
'name': '11',
|
||||
'progress': 12,
|
||||
'tenant_id': '13',
|
||||
|
@ -89,6 +91,7 @@ class TestServer(testtools.TestCase):
|
|||
self.assertEqual(EXAMPLE['accessIPv6'], sot.access_ipv6)
|
||||
self.assertEqual(EXAMPLE['addresses'], sot.addresses)
|
||||
self.assertEqual(EXAMPLE['created'], sot.created_at)
|
||||
self.assertEqual(EXAMPLE['config_drive'], sot.has_config_drive)
|
||||
self.assertEqual(EXAMPLE['flavorRef'], sot.flavor_id)
|
||||
self.assertEqual(EXAMPLE['flavor'], sot.flavor)
|
||||
self.assertEqual(EXAMPLE['hostId'], sot.host_id)
|
||||
|
@ -97,6 +100,7 @@ class TestServer(testtools.TestCase):
|
|||
self.assertEqual(EXAMPLE['image'], sot.image)
|
||||
self.assertEqual(EXAMPLE['links'], sot.links)
|
||||
self.assertEqual(EXAMPLE['metadata'], sot.metadata)
|
||||
self.assertEqual(EXAMPLE['networks'], sot.networks)
|
||||
self.assertEqual(EXAMPLE['name'], sot.name)
|
||||
self.assertEqual(EXAMPLE['progress'], sot.progress)
|
||||
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
|
||||
|
@ -135,7 +139,7 @@ class TestServer(testtools.TestCase):
|
|||
self.assertFalse(sot.allow_delete)
|
||||
self.assertTrue(sot.allow_list)
|
||||
|
||||
def test_change_passowrd(self):
|
||||
def test_change_password(self):
|
||||
sot = server.Server(**EXAMPLE)
|
||||
|
||||
self.assertIsNone(sot.change_password(self.sess, 'a'))
|
||||
|
|
Loading…
Reference in New Issue