Rename image_id to image when create a container
Currently, magnum used "image_id" to reflect the image in container, but actually, we can support use both image name and image id to create a container. The name "image_id" may confuse user that we only support "image_id" when create a container. This patch rename the "image_id" to "image" when create a container. Change-Id: I6de28ec714f5a03fd5a44c1c95e0f68fcf2856b4 Closes-Bug: #1466278
This commit is contained in:
parent
d85771aaea
commit
252586a7b7
|
@ -26,14 +26,14 @@ CONTAINER1 = {'id': 123,
|
|||
'uuid': '66666666-7777-8888-9999-000000000001',
|
||||
'bay_uuid': '25d5d872-1f4e-4134-ae15-c5fa38cb09a3',
|
||||
'name': 'container1',
|
||||
'image_id': 'c-image1',
|
||||
'image': 'c-image1',
|
||||
'command': 'c-command1',
|
||||
}
|
||||
CONTAINER2 = {'id': 124,
|
||||
'uuid': '66666666-7777-8888-9999-000000000002',
|
||||
'bay_uuid': '25d5d872-1f4e-4134-ae15-c5fa38cb09a3',
|
||||
'name': 'container1',
|
||||
'image_id': 'c-image2',
|
||||
'image': 'c-image2',
|
||||
'command': 'c-command2',
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ class ContainerManagerTest(testtools.TestCase):
|
|||
]
|
||||
self.assertEqual(expect, self.api.calls)
|
||||
self.assertEqual(CONTAINER1['name'], container.name)
|
||||
self.assertEqual(CONTAINER1['image_id'], container.image_id)
|
||||
self.assertEqual(CONTAINER1['image'], container.image)
|
||||
|
||||
def test_container_create(self):
|
||||
container = self.mgr.create(**CREATE_CONTAINER)
|
||||
|
|
|
@ -452,8 +452,8 @@ class ShellTest(base.TestCase):
|
|||
args = mock.MagicMock()
|
||||
name = "containe1"
|
||||
args.name = name
|
||||
image_id = "test_image_id"
|
||||
args.image_id = image_id
|
||||
image = "test_image"
|
||||
args.image = image
|
||||
bay_id_or_name = "xxx"
|
||||
args.bay_id = bay_id_or_name
|
||||
command = "test_command"
|
||||
|
@ -461,7 +461,7 @@ class ShellTest(base.TestCase):
|
|||
|
||||
shell.do_container_create(client_mock, args)
|
||||
client_mock.containers.create.assert_called_once_with(
|
||||
name=name, image_id=image_id, bay_uuid=bay.uuid, command=command)
|
||||
name=name, image=image, bay_uuid=bay.uuid, command=command)
|
||||
|
||||
def test_do_container_list(self):
|
||||
client_mock = mock.MagicMock()
|
||||
|
|
|
@ -19,7 +19,7 @@ from magnumclient.common import utils
|
|||
from magnumclient import exceptions
|
||||
|
||||
|
||||
CREATION_ATTRIBUTES = ['name', 'image_id', 'command', 'bay_uuid']
|
||||
CREATION_ATTRIBUTES = ['name', 'image', 'command', 'bay_uuid']
|
||||
|
||||
|
||||
class Container(base.Resource):
|
||||
|
|
|
@ -530,9 +530,9 @@ def do_service_show(cs, args):
|
|||
@utils.arg('--name',
|
||||
metavar='<name>',
|
||||
help='name of the container')
|
||||
@utils.arg('--image_id',
|
||||
metavar='<image_id>',
|
||||
help='ID of the image')
|
||||
@utils.arg('--image',
|
||||
metavar='<image>',
|
||||
help='name or ID of the image')
|
||||
@utils.arg('--bay',
|
||||
required=True,
|
||||
metavar='<bay>',
|
||||
|
@ -550,7 +550,7 @@ def do_container_create(cs, args):
|
|||
return
|
||||
opts = {}
|
||||
opts['name'] = args.name
|
||||
opts['image_id'] = args.image_id
|
||||
opts['image'] = args.image
|
||||
opts['bay_uuid'] = bay.uuid
|
||||
opts['command'] = args.command
|
||||
_show_container(cs.containers.create(**opts))
|
||||
|
|
Loading…
Reference in New Issue