← Back to team overview

ubuntu-server-ec2-testing-dev team mailing list archive

[Merge] lp:~rcj/ubuntu-server-ec2-testing/ubuntu-server-ec2-testing into lp:ubuntu-server-ec2-testing

 

Robert C Jennings has proposed merging lp:~rcj/ubuntu-server-ec2-testing/ubuntu-server-ec2-testing into lp:ubuntu-server-ec2-testing.

Requested reviews:
  Ben Howard (utlemming)
Related bugs:
  Bug #1298562 in Ubuntu Server ec2 Testing: "Missing machine image results in silent error"
  https://bugs.launchpad.net/ubuntu-server-ec2-testing/+bug/1298562

For more details, see:
https://code.launchpad.net/~rcj/ubuntu-server-ec2-testing/ubuntu-server-ec2-testing/+merge/213135

Adding testing for HMV virtualization in addition to PV.
-- 
https://code.launchpad.net/~rcj/ubuntu-server-ec2-testing/ubuntu-server-ec2-testing/+merge/213135
Your team Ubuntu Server ec2 Testing Developers is subscribed to branch lp:ubuntu-server-ec2-testing.
=== modified file 'src/execute_ubuntu_ec2_test.py'
--- src/execute_ubuntu_ec2_test.py	2014-01-22 23:33:49 +0000
+++ src/execute_ubuntu_ec2_test.py	2014-03-27 19:45:23 +0000
@@ -36,6 +36,7 @@
 DEFAULT_RELEASE='precise'
 DEFAULT_VARIANT='server'
 DEFAULT_ARCH='amd64'
+DEFAULT_VIRT_TYPE='paravirtual'
 
 TEST_CONFIG='global/tests.yaml'
 ARCH_CONFIG='global/archs.yaml'
@@ -48,7 +49,7 @@
 parser.add_option("-t","--tests", dest="test_dir", default=DEFAULT_TEST_DIR,
                   help="directory containing test definitions (default=%s)" % DEFAULT_TEST_DIR)
 parser.add_option("-c","--credentials", dest="credentials",default=DEFAULT_CREDS_FILE,
-                  help="ec2 access credentialsi (default=%s)" % DEFAULT_CREDS_FILE)
+                  help="ec2 access credentials (default=%s)" % DEFAULT_CREDS_FILE)
 parser.add_option("-r","--region", dest="region",default=DEFAULT_REGION,
                   help="ec2 region to execute test in (default=%s)" % DEFAULT_REGION)
 parser.add_option("-s","--storage", dest="storage",default=DEFAULT_STORAGE,
@@ -61,10 +62,16 @@
                   help="Ubuntu variant for AMI image (default=%s)" % DEFAULT_VARIANT)
 parser.add_option("-b","--build", dest="build_date",default=DEFAULT_BUILD_DATE,
                   help="Ubuntu image build date CCYYMMDD(.X) (default=%s)" % DEFAULT_BUILD_DATE)
+parser.add_option("--virt-type", dest="virt_type",default=DEFAULT_VIRT_TYPE,
+                  help="Virtualization type 'paravirtual' or 'hvm' (default=%s)" % DEFAULT_VIRT_TYPE)
 
 
 (options, args) = parser.parse_args()
 
+# Allow some wiggle room on virt-type to accommodate existing test harness
+if (options.virt_type == 'paravirt' or options.virt_type == 'pv'):
+    options.virt_type = "paravirtual"
+
 if options.debug:
     logging.basicConfig(level=logging.DEBUG)
 else:
@@ -122,11 +129,14 @@
 # This array will contain all of the tests
 tests_to_run = []
 
+arch_lookup = options.arch
+if options.virt_type == 'hvm':
+    arch_lookup = 'hvm-' + arch_lookup
 # If the file is well formated this should work OK!
-for instance_size in arch_config[options.arch][instance_type]:
+for instance_size in arch_config[arch_lookup][instance_type]:
     for placement in region_config[options.region][zone]:
         logging.info('Creating test for size:%s for arch:%s in region:%s placement:%s root storage:%s',
-                      instance_size,options.arch,options.region,placement,options.storage)
+                      instance_size,arch_lookup,options.region,placement,options.storage)
         test_count = test_count + (1 * number_of_instances)                      
         # Retrieve AMI information
         logging.debug("Retrieving AMI Image %s,%s,%s,%s,%s for %s image", 
@@ -134,13 +144,26 @@
                       options.region,options.storage,
                       options.build_date)
                     
-        l_mi = retrieve_mi(options.release,options.variant,options.arch,
-                           options.region,options.storage,options.build_date)
-                    
+        l_mi = retrieve_mi(release=options.release,
+                           variant=options.variant,
+                           arch=options.arch,
+                           region=options.region,
+                           instance_type=options.storage,
+                           release_date=options.build_date,
+                           virt_type=options.virt_type)
+        
+        if l_mi is None:
+            logging.error("Could not find machine image for testing")
+            sys.exit(1)
+
         logging.debug('Creating TestCase')
         l_tc = TestCase(tname,instance_size,
                         placement,options.test_dir)
                     
+        if l_tc is None:
+            logging.error("Could not find test case '%s'", tname)
+            sys.exit(1)
+
         if (l_mi and l_tc):
             logging.debug('Creating TestCaseExecutor')
             l_tce = TestCaseExecutor(l_mi,l_tc,number_of_instances,

=== modified file 'src/ubuntu/ec2/settings.py'
--- src/ubuntu/ec2/settings.py	2013-05-17 22:51:27 +0000
+++ src/ubuntu/ec2/settings.py	2014-03-27 19:45:23 +0000
@@ -50,6 +50,7 @@
 }
 
 # Valid combinations of instance types and underlying storage
+# Source https://aws.amazon.com/amazon-linux-ami/instance-type-matrix/
 INSTANCE_TYPE_STORAGE_LOOKUP = {
     't1.micro'    : [ 'ebs' ],
     'm1.small'    : [ 'ebs' , 'instance-store' ],
@@ -58,13 +59,24 @@
     'm2.xlarge'   : [ 'ebs' , 'instance-store' ],
     'm2.2xlarge'  : [ 'ebs' , 'instance-store' ],
     'm2.4xlarge'  : [ 'ebs' , 'instance-store' ],
-    'm3.xlarge'   : [ 'ebs' ],
-    'm3.2xlarge'  : [ 'ebs' ],
+    'm3.medium'   : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'm3.large'    : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'm3.xlarge'   : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'm3.2xlarge'  : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'c3.large'    : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'c3.xlarge'   : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'c3.2xlarge'  : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'c3.4xlarge'  : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
+    'c3.8xlarge'  : [ 'ebs' , 'instance-store' , 'hvm-ebs' , 'hvm-instance-store' ],
     'c1.medium'   : [ 'ebs' , 'instance-store' ],
     'c1.xlarge'   : [ 'ebs' , 'instance-store' ],
-    'c2.xlarge'   : [ 'ebs' , 'instance-store' ],
-    'cc1.4xlarge' : [ 'ebs' , 'instance-store' ],
-    'cg1.4xlarge' : [ 'ebs' , 'instance-store' ]
+    'cc2.8xlarge' : [ 'hvm-ebs' , 'hvm-instance-store' ],
+    'i2.xlarge'   : [ 'hvm-ebs' , 'hvm-instance-store' ],
+    'i2.2xlarge'  : [ 'hvm-ebs' , 'hvm-instance-store' ],
+    'i2.4xlarge'  : [ 'hvm-ebs' , 'hvm-instance-store' ],
+    'i2.8xlarge'  : [ 'hvm-ebs' , 'hvm-instance-store' ],
+    'g2.2xlarge'  : [ 'hvm-ebs' ],
+    'cg1.4xlarge' : [ 'hvm-ebs' ],
 }
 
 # Keys for parsing yaml files

=== modified file 'src/ubuntu/ec2/testing.py'
--- src/ubuntu/ec2/testing.py	2014-01-02 17:30:24 +0000
+++ src/ubuntu/ec2/testing.py	2014-03-27 19:45:23 +0000
@@ -89,6 +89,20 @@
     '''
     This class encapsulates a Machine Image
     '''
+    STR_FORMAT = '''
+        MachineImage: 
+            - release:       %s
+            - variant:       %s
+            - release_type:  %s
+            - release_date:  %s
+            - instance_type: %s
+            - arch:          %s
+            - region:        %s
+            - ami:           %s
+            - aki:           %s
+            - virt_type:     %s
+        '''
+
     def __init__ (self):
         '''
         Constructs an empty MachineImage
@@ -105,6 +119,19 @@
         self.virt_type = None
 
 
+    def __str__(self):
+        return self.STR_FORMAT % (self.release,
+                                  self.variant,
+                                  self.release_type,
+                                  self.release_date,
+                                  self.instance_type,
+                                  self.arch,
+                                  self.region,
+                                  self.ami,
+                                  self.aki,
+                                  self.virt_type)
+
+
     def parse_mi(self, raw_data=None):
         '''
         Parses a tuple of arrays to get AMI information
@@ -243,13 +270,17 @@
                           self.test_case.placement, self.image.region)
             raise TestException('Invalid placement %s specified for region %s'
                                 % (self.test_case.placement, self.image.region))
+
         # Also check to see if instancetype + storage option is OK
-        if (self.image.instance_type not in
+        img_instance_type = self.image.instance_type
+        if self.image.virt_type and self.image.virt_type == 'hvm':
+            img_instance_type = 'hvm-' + img_instance_type
+        if (img_instance_type not in
             settings.INSTANCE_TYPE_STORAGE_LOOKUP[self.test_case.instance_type]):
             logging.error('Invalid storage type %s specified for instance size %s',
-                          self.image.instance_type, self.test_case.instance_type)
+                          img_instance_type, self.test_case.instance_type)
             raise TestException('Invalid storage type %s specified for instance size %s'
-                                % (self.image.instance_type, self.test_case.instance_type))
+                                % (img_instance_type, self.test_case.instance_type))
 
     def __str__(self):
         return self.STR_FORMAT % (self.image.ami,
@@ -963,14 +994,18 @@
         # If not the latest then will be a '20100102' type image
         l_url = UEC_IMAGES_ALL_URL % (release, variant)
 
-    logging.info("Retieving ec2 AMI informfation from %s", l_url)
+    logging.info("Retieving ec2 AMI information from %s", l_url)
     l_fh = urllib.urlopen(l_url)
     l_regex = re.compile(QUERY_REGEX)
     l_mi = MachineImage()
     l_ami_found = False
 
+    logging.debug("Looking for release:%s varian:%s arch:%s region:%s " +
+                  "instance_type:%s release_date:%s virt_type:%s",
+                  release, variant, arch, region, instance_type,
+                  release_date, virt_type)
     for ami in l_fh:
-        # logging.debug(ami)
+        logging.debug(ami)
         l_raw = l_regex.findall(ami)
         l_mi.parse_mi(l_raw)
         if (release_date == LATEST_RELEASE):
@@ -981,6 +1016,7 @@
                 (l_mi.instance_type == instance_type) and
                 (l_mi.virt_type == virt_type)):
                 logging.info("Found AMI %s ", l_mi.ami)
+                logging.debug(l_mi)
                 l_ami_found = True
                 break
         else:
@@ -992,6 +1028,7 @@
                 (l_mi.release_date == release_date) and
                 (l_mi.virt_type == virt_type)):
                 logging.info("Found AMI %s ", l_mi.ami)
+                logging.debug(l_mi)
                 l_ami_found = True
                 break
 


Follow ups