[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, experimental, updated. debian/2.1.1-1_experimental1-51-g95835b7

Garrett Holmstrom gholms at fedoraproject.org
Thu Jan 3 11:06:11 UTC 2013


The following commit has been merged in the experimental branch:
commit 6755755d4536203897ffcbba3b39e03e218cac0b
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Wed Oct 31 17:52:19 2012 -0700

    Downgrade >10G image errors to warnings
    
    euca-bundle-vol previously errored out upon encountering images that are
    larger than EC2's limit of 10 GB.  Both that tool and euca-bundle-image
    now merely print warnings when this happens.
    
    Fixes TOOLS-145

diff --git a/euca2ools/bundler.py b/euca2ools/bundler.py
index 722dcda..de36209 100644
--- a/euca2ools/bundler.py
+++ b/euca2ools/bundler.py
@@ -57,8 +57,16 @@ VERSION = '2007-10-10'
 RELEASE = '31337'
 AES = 'AES-128-CBC'
 
+# Number of bytes to read per I/O operation while bundling
 IMAGE_IO_CHUNK = 10 * 1024
+# Number of bytes per part of a bundle
 IMAGE_SPLIT_CHUNK = IMAGE_IO_CHUNK * 1024
+# Recommended maximum number of bytes in an instance-store image (10G)
+# Don't make this an error, though -- 10G might be the limit in EC2, but in
+# Eucalyptus the sky's the limit; people can make images as large as their
+# patience allows.
+IMAGE_MAX_SIZE = 10 * 1024 * 1024 * 1024
+
 MAX_LOOP_DEVS = 256
 
 class Bundler(object):
@@ -110,6 +118,9 @@ class Bundler(object):
         image_size = os.path.getsize(image_file)
         if self.euca.debug:
             print 'Image Size:', image_size, 'bytes'
+        if image_size > IMAGE_MAX_SIZE:
+            print >> sys.stderr, ('warning: this image is larger than 10 GB.  '
+                                  'It will not work in EC2.')
         return image_size
 
     def get_fs_info(self, path):
diff --git a/euca2ools/commands/euca/bundlevol.py b/euca2ools/commands/euca/bundlevol.py
index 11051d0..f6452d0 100644
--- a/euca2ools/commands/euca/bundlevol.py
+++ b/euca2ools/commands/euca/bundlevol.py
@@ -40,14 +40,15 @@ import euca2ools.bundler
 import euca2ools.metadata
 from euca2ools.exceptions import *
 
-MAX_IMAGE_SIZE = 1024 * 10
+IMAGE_MAX_SIZE_IN_MB = euca2ools.bundler.IMAGE_MAX_SIZE / 1024 // 1024
 
 class BundleVol(euca2ools.commands.eucacommand.EucaCommand):
-
     Description = 'Bundles an image for use with Eucalyptus or Amazon EC2.'
     Options = [Param(name='size', short_name='s', long_name='size',
-                     optional=True, ptype='integer', default=MAX_IMAGE_SIZE,
-                     doc='Size of the image in MB(max=%d).' % MAX_IMAGE_SIZE),
+                     optional=True, ptype='integer',
+                     default=IMAGE_MAX_SIZE_IN_MB,
+                     doc=('Size of the image in MB (default: {0}; recommended '
+                          'maximum: {0})').format(IMAGE_MAX_SIZE_IN_MB)),
                Param(name='user', short_name='u', long_name='user',
                      optional=True, ptype='string',
                      doc="""User ID (12-digit) of the user who is
@@ -120,11 +121,6 @@ class BundleVol(euca2ools.commands.eucacommand.EucaCommand):
             print 'Must be superuser to execute this command.'
             sys.exit()
 
-    def check_image_size(self, size):
-        if size > MAX_IMAGE_SIZE:
-            msg = 'Image Size is too large (Max = %d MB)' % MAX_IMAGE_SIZE
-            self.display_error_and_exit(msg)
-
     def parse_excludes(self, excludes_string):
         excludes = []
         if excludes_string:
@@ -225,9 +221,6 @@ class BundleVol(euca2ools.commands.eucacommand.EucaCommand):
             else:
                 self.fstab_path = 'new'
         self.check_root()
-        if self.size > MAX_IMAGE_SIZE:
-            msg = 'Image Size is too large (Max = %d MB)' % MAX_IMAGE_SIZE
-            self.display_error_and_exit(msg)
         self.volume_path = os.path.normpath(self.volume_path)
 
         noex='EUCA_BUNDLE_VOL_EMPTY_EXCLUDES'

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list