We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 98fbc56 + 89e5d67 commit 0fb1caeCopy full SHA for 0fb1cae
2 files changed
openstackclient/compute/v2/server.py
@@ -1602,6 +1602,12 @@ def _match_image(image_api, wanted_properties):
1602
]
1603
elif parsed_args.boot_from_volume:
1604
# Tell nova to create a root volume from the image provided.
1605
+ if not image:
1606
+ msg = _(
1607
+ "An image (--image or --image-property) is required "
1608
+ "to support --boot-from-volume option"
1609
+ )
1610
+ raise exceptions.CommandError(msg)
1611
block_device_mapping_v2 = [
1612
{
1613
'uuid': image.id,
openstackclient/tests/unit/compute/v2/test_server.py
@@ -3414,6 +3414,34 @@ def test_server_create_volume_boot_from_volume_conflict(self):
3414
'--volume is not allowed with --boot-from-volume', str(ex)
3415
)
3416
3417
+ def test_server_create_boot_from_volume_no_image(self):
3418
+ # Test --boot-from-volume option without --image or
3419
+ # --image-property.
3420
+ arglist = [
3421
+ '--flavor',
3422
+ self.flavor.id,
3423
+ '--boot-from-volume',
3424
+ '1',
3425
+ self.new_server.name,
3426
+ ]
3427
+ verifylist = [
3428
+ ('flavor', self.flavor.id),
3429
+ ('boot_from_volume', 1),
3430
+ ('config_drive', False),
3431
+ ('server_name', self.new_server.name),
3432
3433
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
3434
+
3435
+ ex = self.assertRaises(
3436
+ exceptions.CommandError, self.cmd.take_action, parsed_args
3437
3438
+ # Assert it is the error we expect.
3439
+ self.assertIn(
3440
+ 'An image (--image or --image-property) is required '
3441
+ 'to support --boot-from-volume option',
3442
+ str(ex),
3443
3444
3445
def test_server_create_image_property(self):
3446
arglist = [
3447
'--image-property',
0 commit comments