Fix compute tests for resource.prop ID attributes

Fix unit, functional and examples tests for [1]. Also
fix the documentation for the server image_id and flavor_id
properties.

[1] https://review.openstack.org/#/c/279618/

Change-Id: Ia37ecc7c9dccb90fabf7bf73601a6ad519212556
Partial-Bug: #1461200
This commit is contained in:
Richard Theis 2016-02-15 09:12:57 -06:00
parent c2383e8acc
commit b4b9104d5c
4 changed files with 10 additions and 14 deletions

View File

@ -61,7 +61,7 @@ def create_server(conn):
keypair = create_keypair(conn)
server = conn.compute.create_server(
name=SERVER_NAME, image=image, flavor=flavor,
name=SERVER_NAME, image_id=image.id, flavor_id=flavor.id,
networks=[{"uuid": network.id}], key_name=keypair.name)
server = conn.compute.wait_for_server(server)

View File

@ -41,18 +41,14 @@ class Server(resource.Resource, metadata.MetadataMixin):
addresses = resource.prop('addresses', type=dict)
#: Timestamp of when the server was created.
created_at = resource.prop('created')
#: A dictionary with details on the flavor this server is running.
#: The dictionary includes a key for the ``id`` of the flavor, as well
#: as a ``links`` key, which includes a list of relevant links for this
#: flavor. *Type: dict*
flavor_id = resource.prop('flavorRef', alias='flavor', type=dict)
#: The flavor reference, as a ID or full URL, for the flavor to use for
#: this server.
flavor_id = resource.prop('flavorRef')
#: An ID representing the host of this server.
host_id = resource.prop('hostId')
#: A dictionary with details on the image this server is running.
#: The dictionary includes a key for ``id`` of the image, as well
#: as a ``links`` key, which includes a list of relevant links for this
#: image. *Type: dict*
image_id = resource.prop('imageRef', alias='image', type=dict)
#: The image reference, as a ID or full URL, for the image to use for
#: this server.
image_id = resource.prop('imageRef')
#: A list of dictionaries holding links relevant to this server.
links = resource.prop('links')
#: Metadata stored for this server. *Type: dict*

View File

@ -40,7 +40,7 @@ class TestServer(base.BaseFunctionalTest):
else:
args = {}
sot = cls.conn.compute.create_server(
name=cls.NAME, flavor=flavor.id, image=image.id, **args)
name=cls.NAME, flavor_id=flavor.id, image_id=image.id, **args)
cls.conn.compute.wait_for_server(sot)
assert isinstance(sot, server.Server)
cls.assertIs(cls.NAME, sot.name)

View File

@ -23,10 +23,10 @@ EXAMPLE = {
'accessIPv6': '2',
'addresses': {'region': '3'},
'created': '4',
'flavorRef': {'id': 5},
'flavorRef': '5',
'hostId': '6',
'id': IDENTIFIER,
'imageRef': {'id': 8},
'imageRef': '8',
'links': '9',
'metadata': {'key': '10'},
'name': '11',