[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, experimental, updated. debian/2.1.3-1_experimental1
Garrett Holmstrom
gholms at fedoraproject.org
Sat Mar 16 03:26:41 UTC 2013
The following commit has been merged in the experimental branch:
commit 115998300a95c768b1d8fc0fbb980d0a07b0d368
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date: Tue Jan 29 17:53:37 2013 -0800
Behave more intuitively when both -s and -b are supplied to euca-register
Fixes TOOLS-182
diff --git a/euca2ools/commands/euca/register.py b/euca2ools/commands/euca/register.py
index 2e0089b..5333631 100644
--- a/euca2ools/commands/euca/register.py
+++ b/euca2ools/commands/euca/register.py
@@ -33,6 +33,7 @@
import euca2ools.commands.eucacommand
+import sys
from boto.roboto.param import Param
class Register(euca2ools.commands.eucacommand.EucaCommand):
@@ -71,15 +72,29 @@ class Register(euca2ools.commands.eucacommand.EucaCommand):
optional=True, ptype='string',
doc="""Path to the uploaded image (bucket/manifest).
Required if registering an S3-based image""")]
-
+
def main(self):
+ # Make a mapping out of --block-device-mapping args
+ mappings = self.parse_block_device_args(self.block_device_mapping or '')
if self.snapshot:
+ # Make a mapping out of --snapshot and --root-device-name
if not self.root_device_name:
self.root_device_name = '/dev/sda1'
- self.block_device_mapping.append('%s=%s' % (self.root_device_name,
- self.snapshot))
- if self.block_device_mapping:
- self.block_device_mapping = self.parse_block_device_args(self.block_device_mapping)
+ shortcut_map_strs = ['%s=%s' % (self.root_device_name,
+ self.snapshot)]
+ shortcut_map = self.parse_block_device_args(shortcut_map_strs)
+ if self.root_device_name in mappings:
+ if (mappings[self.root_device_name].snapshot_id !=
+ self.snapshot):
+ sys.exit(('Snapshot supplied with --snapshot differs '
+ 'from the block device mapping with device %s') %
+ self.root_device_name)
+ # If they match then the one supplied with -b will be correct
+ else:
+ # Add the shortcut one
+ mappings.update(shortcut_map)
+ self.block_device_mapping = mappings
+
conn = self.make_connection_cli()
return self.make_request_cli(conn, 'register_image',
name=self.name,
--
managing cloud instances for Eucalyptus
More information about the pkg-eucalyptus-commits
mailing list