Beispiel #1
0
 def setUp(self):
     self.conf = "cloud.conf"
     self.tester = Eucaops(config_file=self.conf, password="******")
     self.iu = ImageUtils(tester=self.tester, config_file=self.conf)
     self.imgName = "bfebs-centos-vmwaretools-i386.img"
     self.imgUrl = "http://mirror.qa.eucalyptus-systems.com/bfebs-image/vmware/"
     self.errorMsg = "all associated instances must be in the terminated state."
     self.count = 0
     self.doAuth()
Beispiel #2
0
 def setUp(self):
     self.conf = "cloud.conf"
     self.bucket = "test-bucket"
     self.imgName = "bfebs-centos-vmwaretools-i386.img"
     self.imgUrl =  "http://mirror.qa.eucalyptus-systems.com/bfebs-image/vmware/"     
     self.tester  = Eucaops( config_file=self.conf, password="******" )
     self.source  = "source " + self.tester.credpath + "/eucarc && "
     self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
     self.doAuth()
Beispiel #3
0
class Euca3460(unittest.TestCase):
    
    def setUp(self):

        self.conf = "cloud.conf"       
        self.imgName = "windowsserver2003r2_ent_x64.kvm.img"
        self.tester  = Eucaops( config_file=self.conf, password="******" )
        self.source  = "source " + self.tester.credpath + "/eucarc && "
        self.clc1 = self.tester.service_manager.get_enabled_clc() 
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
        self.iu.create_emi_from_url( "http://192.168.7.65/windows_images/" + self.imgName )
        self.doAuth()
        
    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)
        self.tester.authorize_group(self.group, port=3389, protocol="tcp")
        self.skey = self.tester.get_secret_key()
        self.akey = self.tester.get_access_key()
                   
    def test_EUCA_3460(self):      
        self.emi = self.tester.get_emi(location=self.imgName)
        #Start the windows instance
        self.reservation = self.tester.run_instance(self.emi,type="m1.large", keypair=self.keypair.name, group=self.group, is_reachable=False,timeout=720)
        # Make sure the windows instance is running
        
        for instance in self.reservation.instances:
            if instance.state == "running":
                self.ip = instance.public_dns_name
                self.instanceid = instance.id
                                
        # Attempt to bundle the running windows instance
        print "Access  = " + self.akey 
        print "Secret  = " + self.skey 
        self.cmd = "euca-bundle-instance " + self.instanceid + " -b " + str(self.keypair) + " -p windows -o " + self.akey + " -w " + self.skey
        self.out = self.clc1.machine.cmd(self.source + self.cmd)
        
        # Check for Bundle ID
        match = re.search(r'bun-........', self.out["output"])
        if match:
            self.tester.debug("Passed test_EUCA_3460: Bundle ID = " + match.group())
        else: 
            self.fail("Failed test_EUCA_3460: Bundle ID not returned") 
         
                       
    def tearDown(self):
        if self.reservation is not None:
            self.tester.terminate_instances(self.reservation)  
        self.tester.delete_keypair(self.keypair)
        self.tester.local("rm " + self.keypair.name + ".pem") 
        shutil.rmtree(self.tester.credpath)  
              
                 
    if __name__ == '__main__':
        unittest.main("Euca3460")
Beispiel #4
0
    def setUp(self):

        self.conf = "cloud.conf"       
        self.imgName = "windowsserver2003r2_ent_x64.kvm.img"
        self.tester  = Eucaops( config_file=self.conf, password="******" )
        self.source  = "source " + self.tester.credpath + "/eucarc && "
        self.clc1 = self.tester.service_manager.get_enabled_clc() 
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
        self.iu.create_emi_from_url( "http://192.168.7.65/windows_images/" + self.imgName )
        self.doAuth()
Beispiel #5
0
 def get_windows_image(self):
     # Check for windows image if there is not one get it.
     try:
         self.emi = self.tester.get_emi(location='windows')
     except:
         self.iu = ImageUtils(tester=self.tester, config_file=self.conf)
         self.iu.create_emi_from_url(
             "http://mirror.eucalyptus-systems.com/images/windows_images/" +
             self.imgName)
         self.emi = self.tester.get_emi(location='windows')
Beispiel #6
0
class Euca2244(unittest.TestCase):

    def setUp(self):
        self.conf = "cloud.conf"
        self.bucket = "test-bucket"
        self.imgName = "bfebs-centos-vmwaretools-i386.img"
        self.imgUrl =  "http://mirror.qa.eucalyptus-systems.com/bfebs-image/vmware/"     
        self.tester  = Eucaops( config_file=self.conf, password="******" )
        self.source  = "source " + self.tester.credpath + "/eucarc && "
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
        self.doAuth()

    def tearDown(self):
        self.tester.sys(self.source + "euca-deregister " + self.emi)
        self.tester.sys(self.source + "euca-delete-bundle -b " + self.imgName + "test0")
        self.tester.delete_keypair(self.keypair)
        self.tester.local("rm " + self.keypair.name + ".pem") 
        shutil.rmtree(self.tester.credpath)  
    
    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)

    def testName(self):
        self.emi = self.iu.create_emi_from_url( self.imgUrl + self.imgName)
        self.out = self.tester.sys(self.source + "euca-describe-images " + self.emi)
        self.count = str(self.out).count("private")
        if self.count==1:
            self.tester.debug("SUCCESS The default image availability is private")
            pass
        else:
            self.fail("FAIL The default image availability is public not private")
 def create_image_from_url(self, url=None):
     """
     Definition: Attempts to create a windows image from a provided URL
     """
     url = url or self.args.image_url
     if not url:
         raise ValueError('No url provided to "create_image_from_url"')
     self.debug('Attempting to create image from:' + str(url))
     image_utils = ImageUtils(tester=self.tester)
     image = image_utils.create_emi(url=url,
                                    platform='windows',
                                    kernel='windows')
     self.status('Setting launch permissions to "all" on image:' + str(image.id))
     image.set_launch_permissions(group_names=['all'])
     self.debug('created image:' + str(image.id))
     self.image = image
     return image
Beispiel #8
0
 def get_windows_image(self):
     # Check for windows image if there is not one get it.
     try:
       self.emi = self.tester.get_emi(location='windows')
     except:
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
        self.iu.create_emi_from_url( "http://mirror.eucalyptus-systems.com/images/windows_images/" + self.imgName )
        self.emi = self.tester.get_emi(location='windows')
Beispiel #9
0
 def setUp(self):
     self.conf = "cloud.conf"
     self.tester  = Eucaops( config_file=self.conf, password="******" )
     self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
     self.imgName = "bfebs-centos-vmwaretools-i386.img"
     self.imgUrl =  "http://mirror.qa.eucalyptus-systems.com/bfebs-image/vmware/"
     self.errorMsg = "all associated instances must be in the terminated state."
     self.count = 0
     self.doAuth()
Beispiel #10
0
 def create_image_from_url(self, url=None):
     """
     Definition: Attempts to create a windows image from a provided URL
     """
     url = url or self.args.image_url
     if not url:
         raise ValueError('No url provided to "create_image_from_url"')
     self.debug('Attempting to create image from:' + str(url))
     image_utils = ImageUtils(tester=self.tester)
     image = image_utils.create_emi(url=url,
                                    platform='windows',
                                    kernel='windows')
     self.status('Setting launch permissions to "all" on image:' +
                 str(image.id))
     image.set_launch_permissions(group_names=['all'])
     self.debug('created image:' + str(image.id))
     self.image = image
     return image
Beispiel #11
0
    def setUp(self):

        self.conf = "cloud.conf"
        self.imgName = "windowsserver2003r2_ent_x64.kvm.img"
        self.tester = Eucaops(config_file=self.conf, password="******")
        self.source = "source " + self.tester.credpath + "/eucarc && "
        self.clc1 = self.tester.service_manager.get_enabled_clc()
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf)
        self.iu.create_emi_from_url("http://192.168.7.65/windows_images/" + self.imgName)
        self.doAuth()
Beispiel #12
0
class Euca1057(unittest.TestCase):
    def setUp(self):
        self.conf = "cloud.conf"
        self.tester = Eucaops(config_file=self.conf, password="******")
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf)
        self.imgName = "bfebs-centos-vmwaretools-i386.img"
        self.imgUrl = "http://mirror.qa.eucalyptus-systems.com/bfebs-image/vmware/"
        self.errorMsg = "all associated instances must be in the terminated state."
        self.count = 0
        self.doAuth()

    def tearDown(self):
        if self.reservation is not None:
            self.tester.terminate_instances(self.reservation)
        self.out = self.runSysCmd("euca-deregister " + self.emi)
        self.tester.delete_keypair(self.keypair)
        self.tester.local("rm " + self.keypair.name + ".pem")
        shutil.rmtree(self.tester.credpath)

    def runSysCmd(self, cmd):
        self.source = "source " + self.tester.credpath + "/eucarc && "
        self.out = self.tester.sys(self.source + cmd)

    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)

    def testName(self):
        self.emi = self.iu.create_emi_from_url(self.imgUrl + self.imgName)
        self.reservation = self.tester.run_instance(image=self.emi,
                                                    is_reachable=False)

        self.runSysCmd("euca-deregister " + self.emi)
        self.count = +str(self.out).count(self.errorMsg)
        if self.count == 1:
            self.tester.debug("SUCCESS proper error thrown ")
            pass
        else:
            self.fail("FAIL incorrect error thrown ")
Beispiel #13
0
class Euca1057(unittest.TestCase):

    def setUp(self):
        self.conf = "cloud.conf"
        self.tester  = Eucaops( config_file=self.conf, password="******" )
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
        self.imgName = "bfebs-centos-vmwaretools-i386.img"
        self.imgUrl =  "http://mirror.qa.eucalyptus-systems.com/bfebs-image/vmware/"
        self.errorMsg = "all associated instances must be in the terminated state."
        self.count = 0
        self.doAuth()

    def tearDown(self):
        if self.reservation is not None:
            self.tester.terminate_instances(self.reservation)
        self.out = self.runSysCmd("euca-deregister " + self.emi)
        self.tester.delete_keypair(self.keypair)
        self.tester.local("rm " + self.keypair.name + ".pem") 
        shutil.rmtree(self.tester.credpath)
                
    def runSysCmd(self, cmd):
        self.source  = "source " + self.tester.credpath + "/eucarc && "
        self.out = self.tester.sys(self.source + cmd) 
        
    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)

    def testName(self):
        self.emi = self.iu.create_emi_from_url( self.imgUrl + self.imgName)
        self.reservation = self.tester.run_instance(image=self.emi,is_reachable=False)

        self.runSysCmd("euca-deregister " + self.emi)
        self.count = + str(self.out).count(self.errorMsg)
        if self.count==1:
            self.tester.debug("SUCCESS proper error thrown ")
            pass
        else:
            self.fail("FAIL incorrect error thrown ")
Beispiel #14
0
class EucaTest(unittest.TestCase):
    def setUp(self):
        self.start_total_time = time.time()
        self.conf = 'cloud.conf'
        self.tester = Eucaops(config_file=self.conf, password='******')
        self.doAuth()
        self.OK = '\033[1m\033[37m\033[42m'
        self.ENDC = '\033[0m'
        self.imgName = "windowsserver2003r2_ent_x64.kvm.img"

    def tearDown(self):
        self.tester.terminate_instances(self.reservation)
        self.tester.modify_property('cloud.vmstate.instance_timeout', '720')
        self.tester.modify_property('cloud.vmstate.terminated_time', '60')
        self.tester.delete_keypair(self.keypair)
        self.tester.local('rm ' + self.keypair.name + '.pem')
        shutil.rmtree(self.tester.credpath)

    def get_windows_image(self):
        # Check for windows image if there is not one get it.
        try:
            self.emi = self.tester.get_emi(location='windows')
        except:
            self.iu = ImageUtils(tester=self.tester, config_file=self.conf)
            self.iu.create_emi_from_url(
                "http://mirror.eucalyptus-systems.com/images/windows_images/" +
                self.imgName)
            self.emi = self.tester.get_emi(location='windows')

    def runInstances(self, numMax):
        self.emi = self.tester.get_emi(location='windows')
        #Start the windows instance
        self.reservation = self.tester.run_instance(self.emi,
                                                    type="m1.large",
                                                    keypair=self.keypair.name,
                                                    group=self.group,
                                                    is_reachable=False,
                                                    timeout=720)
        # Make sure the windows instance is running
        for instance in self.reservation.instances:
            if instance.state == "running":
                self.ip = instance.public_dns_name
                self.instanceid = instance.id
                self.instance = instance

    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)

    def print_time(self, start):
        elapsed = time.time() - start
        minutes = int(elapsed / 60)
        seconds = int(elapsed % 60)
        print self.OK + "Elapsed time = " + str(minutes) + ' min ' + str(
            seconds) + ' sec ' + self.ENDC

    def test(self):
        self.get_windows_image()
        self.tester.modify_property('cloud.vmstate.instance_timeout', '5')
        self.tester.modify_property('cloud.vmstate.terminated_time', '1')
        self.eunode = self.tester.service_manager.get_all_node_controllers()[0]
        #start an instance
        self.runInstances(1)
        #stop the node controller
        self.eunode.stop()

        # wait for instance to terminate, this can take about 12 minutes.
        self.start = time.time()
        while (str(self.instance.state) != 'terminated'):
            self.tester.debug("Waiting for instance to terminate")
            self.instance.update()
            self.tester.debug("Instance State = " + str(self.instance.state))
            self.tester.sleep(30)
            self.print_time(self.start)

        # wait terminated instance to be cleared from euca-describe-instances output.
        self.start = time.time()
        while (str(
                self.tester.sys('euca-describe-instances ' + self.instanceid))
               != '[]'):
            self.tester.debug(
                str(
                    self.tester.sys('euca-describe-instances ' +
                                    self.instanceid)))
            self.tester.debug("Waiting terminate to clear")
            self.tester.sleep(10)
            self.print_time(self.start)

        # start the node controller
        self.eunode.start()

        # wait for instance to restore, this should not take more than 5 minutes
        self.start = time.time()
        while (str(
                self.tester.sys('euca-describe-instances ' +
                                self.instanceid)) == '[]'):
            self.tester.debug(
                str(
                    self.tester.sys('euca-describe-instances ' +
                                    self.instanceid)))
            self.tester.debug("Waiting for instance to restore.")
            self.tester.sleep(10)
            self.print_time(self.start)
            elapsed = time.time() - self.start
            assert int(elapsed / 60) < 5

        print self.OK + 'Total Time' + self.ENDC
        self.print_time(self.start_total_time)
Beispiel #15
0
class Euca3460(unittest.TestCase):
    def setUp(self):

        self.conf = "cloud.conf"
        self.imgName = "windowsserver2003r2_ent_x64.kvm.img"
        self.tester = Eucaops(config_file=self.conf, password="******")
        self.source = "source " + self.tester.credpath + "/eucarc && "
        self.clc1 = self.tester.service_manager.get_enabled_clc()
        self.iu = ImageUtils(tester=self.tester, config_file=self.conf)
        self.iu.create_emi_from_url("http://192.168.7.65/windows_images/" + self.imgName)
        self.doAuth()

    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)
        self.tester.authorize_group(self.group, port=3389, protocol="tcp")
        self.skey = self.tester.get_secret_key()
        self.akey = self.tester.get_access_key()

    def test_EUCA_3460(self):
        self.emi = self.tester.get_emi(location=self.imgName)
        # Start the windows instance
        self.reservation = self.tester.run_instance(
            self.emi, type="m1.large", keypair=self.keypair.name, group=self.group, is_reachable=False, timeout=720
        )
        # Make sure the windows instance is running

        for instance in self.reservation.instances:
            if instance.state == "running":
                self.ip = instance.public_dns_name
                self.instanceid = instance.id

        # Attempt to bundle the running windows instance
        print "Access  = " + self.akey
        print "Secret  = " + self.skey
        self.cmd = (
            "euca-bundle-instance "
            + self.instanceid
            + " -b "
            + str(self.keypair)
            + " -p windows -o "
            + self.akey
            + " -w "
            + self.skey
        )
        self.out = self.clc1.machine.cmd(self.source + self.cmd)

        # Check for Bundle ID
        match = re.search(r"bun-........", self.out["output"])
        if match:
            self.tester.debug("Passed test_EUCA_3460: Bundle ID = " + match.group())
        else:
            self.fail("Failed test_EUCA_3460: Bundle ID not returned")

    def tearDown(self):
        if self.reservation is not None:
            self.tester.terminate_instances(self.reservation)
        self.tester.delete_keypair(self.keypair)
        self.tester.local("rm " + self.keypair.name + ".pem")
        shutil.rmtree(self.tester.credpath)

    if __name__ == "__main__":
        unittest.main("Euca3460")
Beispiel #16
0
    def __init__(
            self,
            #setup eutester and test environment...
            tester=None,
            config_file=None,
            password=None,
            credpath=None,
            eof=True,
            #Information on where to do image bundle work, and related timeouts
            destpath=None,
            time_per_gig=300,
            inter_bundle_timeout=120,
            upload_timeout=0,
            work_component=None,
            component_credpath=None,
            bucketname=None,
            #Test env resources...
            group=None,
            testvolumes=[],
            testvolcount=2,
            keypair=None,
            zone=None,
            url=None,
            user_data=None,
            emi=None,
            private_addressing=False,
            instance_password=None,
            instance_keypath=None,
            vmtype='m1.xlarge',
            emi_location=None,
            image_path=None,  #note this must be available on the work_component
            instance=None,
            clean_on_exit=False,
            authports=[
                'tcp:3389', 'tcp:80', 'tcp:443', 'tcp:5985', 'tcp:5986'
            ]):
        """
        Definition:
        This class is intended to hold most of the methods and state(s) needed to run an array of Windows Instance
        related tests. Most TestUnits will use a subset of these methods to define a testcase/operation. See sample
        testcases scripts which reference this class for examples and use cases.

        :param tester: eutester object
        :param config_file: eutester config file
        :param credpath: path to cloud credentials/eucarc
        :param password: password used to access remote components
        :param eof: boolean, end on failure
        :param destpath: path on 'work component' in which to peform work. ie: where to download and bundle an img.
        :param time_per_gig: Time in seconds to be used for image related timeouts
        :param inter_bundle_timeout: Time to wait between bundle operation. Mainly used to detect hung operations
        :param upload_timeout: Time to wait for the upload portion of image operation
        :param work_component: The component or machine in which work is to be executed on, ie download, bundles, etc.
        :param component_credpath: The path on the 'work_component' in which to find creds. ie for tools exectuted remotely
        :param bucketname: Bucketname to be used as a global for operations in this test.
        :param group: Security group to use for this test
        :param testvolumes: List of volumes that are intended to be used in by this obj's test(s)
        :param testvolcount: Number of volumes to be used for ebs related tests defined in this test obj
        :param keypair: keypair ot be used for this test(s)
        :param zone: zone/cluster to be used to executue these tests
        :param url: url to use for fetching remote images to be built into EMI(s) for this test
        :param user_data: Any (instance) user data to be used for in this test
        :param emi: emi to be used for this test
        :param private_addressing: boolean, used to run instances w/o a public ip
        :param instance_password: password used for accessing instance(s) within this test
        :param instance_keypath: keypath used to access instance(s) within this test
        :param vmtype: type of vm to use when running instance(s) in this test, ie m1.xlarge
        :param emi_location: string used to find an existing EMI by the EMI's location-string
        :param image_path: path to an image on the local machine or work component
        :param instance: existing instance to use within this test
        :param win_proxy_hostname: The ip or FQDN of the machine used to proxy powershell and ldap tests against
        :param win_proxy_username: The user name for ssh login on the machine used to  proxy powershell and ldap tests against
        :param win_proxy_password: The password for ssh login on the machine used to  proxy powershell and ldap tests against
        :param win_proxy_keypath: The keypath for ssh login on the machine used to  proxy powershell and ldap tests against
        :param authports: What ports should be authorized within security group for testing
        """
        self.setuptestcase()
        if tester is None:
            self.tester = Eucaops(config_file=config_file,
                                  password=password,
                                  credpath=credpath)
        else:
            self.tester = tester
        self.tester.exit_on_fail = eof
        self.instance = instance
        if self.instance:
            self.instance = self.tester.get_instances(
                idstring=str(instance))[0]
        self.instance_keypath = instance_keypath
        self.destpath = destpath or '/tmp'
        self.bucketname = bucketname
        self.component = work_component
        self.component_credpath = component_credpath
        self.time_per_gig = time_per_gig
        self.credpath = credpath or self.tester.credpath
        self.url = url
        self.upload_timeout = upload_timeout
        self.inter_bundle_timeout = inter_bundle_timeout
        self.iu = ImageUtils(tester=self.tester,
                             destpath=self.destpath,
                             time_per_gig=self.time_per_gig,
                             work_component=self.component)
        self.group = group
        self.keypair = keypair
        self.zonelist = []
        self.emi = self.tester.get_emi(emi)
        self.image_path = image_path
        self.emi_location = emi_location
        if zone is not None:
            self.zonelist.append(zone)
        self.testvolcount = testvolcount
        self.testvolumes = testvolumes
        self.authports = authports
        self.instance_password = instance_password
        self.vmtype = vmtype
        self.user_data = user_data
        self.private_addressing = private_addressing
        #timeout for run instance command/test
        self.run_timeout = 780
        #setup zone list
        self.setupWindowsZones()
        #setup windows proxy
        self.setup_test_env()
Beispiel #17
0
class EucaTest(unittest.TestCase):
    def setUp(self):
        self.start_total_time = time.time()
        self.conf = 'cloud.conf'
        self.tester = Eucaops(config_file=self.conf, password='******')
        self.doAuth()
        self.OK = '\033[1m\033[37m\033[42m'
        self.ENDC = '\033[0m'
        self.imgName = "windowsserver2003r2_ent_x64.kvm.img"

    def tearDown(self):
        self.tester.terminate_instances(self.reservation)
        self.tester.modify_property('cloud.vmstate.instance_timeout' , '720' )
        self.tester.modify_property('cloud.vmstate.terminated_time' , '60' )
        self.tester.delete_keypair(self.keypair)
        self.tester.local('rm ' + self.keypair.name + '.pem')
        shutil.rmtree(self.tester.credpath)

    def get_windows_image(self):
        # Check for windows image if there is not one get it.
        try:
          self.emi = self.tester.get_emi(location='windows')
        except:
           self.iu = ImageUtils(tester=self.tester, config_file=self.conf )
           self.iu.create_emi_from_url( "http://mirror.eucalyptus-systems.com/images/windows_images/" + self.imgName )
           self.emi = self.tester.get_emi(location='windows')

    def runInstances(self, numMax):
        self.emi = self.tester.get_emi(location='windows')
        #Start the windows instance
        self.reservation = self.tester.run_instance(self.emi,type="m1.large", keypair=self.keypair.name, group=self.group, is_reachable=False,timeout=720)
        # Make sure the windows instance is running
        for instance in self.reservation.instances:
            if instance.state == "running":
                self.ip = instance.public_dns_name
                self.instanceid = instance.id
                self.instance = instance

    def doAuth(self):
        self.keypair = self.tester.add_keypair()
        self.group = self.tester.add_group()
        self.tester.authorize_group(self.group)

    def print_time(self, start):
        elapsed = time.time() - start
        minutes = int(elapsed / 60)
        seconds = int(elapsed % 60)
        print self.OK + "Elapsed time = " +  str(minutes) + ' min ' + str(seconds) + ' sec ' + self.ENDC


    def test(self):
        self.get_windows_image()
        self.tester.modify_property('cloud.vmstate.instance_timeout' , '5' )
        self.tester.modify_property('cloud.vmstate.terminated_time' , '1' )
        self.eunode = self.tester.service_manager.get_all_node_controllers()[0]
        #start an instance
        self.runInstances(1)
        #stop the node controller
        self.eunode.stop()

        # wait for instance to terminate, this can take about 12 minutes.
        self.start = time.time()
        while ( str(self.instance.state) != 'terminated' ):
            self.tester.debug("Waiting for instance to terminate")
            self.instance.update()
            self.tester.debug("Instance State = " + str(self.instance.state))
            self.tester.sleep(30)
            self.print_time(self.start)

        # wait terminated instance to be cleared from euca-describe-instances output.
        self.start = time.time()
        while (  str(self.tester.sys('euca-describe-instances ' + self.instanceid)) != '[]' ):
            self.tester.debug( str(self.tester.sys('euca-describe-instances ' + self.instanceid ) ) )
            self.tester.debug("Waiting terminate to clear")
            self.tester.sleep(10)
            self.print_time(self.start)

        # start the node controller
        self.eunode.start()

        # wait for instance to restore, this should not take more than 5 minutes
        self.start = time.time()
        while (  str(self.tester.sys('euca-describe-instances ' + self.instanceid)) == '[]' ):
            self.tester.debug( str(self.tester.sys('euca-describe-instances ' + self.instanceid ) ) )
            self.tester.debug("Waiting for instance to restore.")
            self.tester.sleep(10)
            self.print_time(self.start)
            elapsed = time.time() - self.start
            assert int(elapsed / 60) < 5

        print self.OK + 'Total Time' + self.ENDC
        self.print_time(self.start_total_time)
Beispiel #18
0
 def __init__(self, 
              #setup eutester and test environment...
              tester=None, 
              config_file=None, 
              cred_path=None,
              password=None, 
              credpath=None, 
              eof=True,
              #Information on where to do image bundle work, and related timeouts
              destpath=None,  
              time_per_gig = 300,
              inter_bundle_timeout=120, 
              upload_timeout=0,
              work_component=None,
              component_credpath=None,
              bucketname = None,
              #Test env resources...
              group = None,
              testvolumes = [],
              testvolcount = 2,
              keypair=None, 
              zone = None,
              url=None,
              user_data=None,
              emi=None,
              private_addressing=False,
              instance_password = None,
              instance_keypath = None,
              vmtype='m1.xlarge',
              emi_location=None,
              image_path=None, #note this must be available on the work_component
              instance=None,
              win_proxy_hostname = None, 
              win_proxy_username = '******',
              win_proxy_password = None, 
              win_proxy_keypath = None,
              authports=['tcp:3389','tcp:80','tcp:443', 'tcp:5985', 'tcp:5986']
              ):
     if tester is None:
         self.tester = Eucaops( config_file=config_file,password=password,credpath=credpath)
     else:
         self.tester = tester
     self.tester.exit_on_fail = eof
     self.instance = instance
     if self.instance:
         self.instance = self.tester.get_instances(idstring=str(instance))[0]
     self.instance_keypath = instance_keypath
     self.destpath = destpath or '/tmp'
     self.bucketname = bucketname
     self.component = work_component 
     self.component_credpath = component_credpath
     self.time_per_gig = time_per_gig
     self.credpath=credpath or self.tester.credpath
     self.url = url
     self.upload_timeout = upload_timeout
     self.inter_bundle_timeout = inter_bundle_timeout
     self.iu = ImageUtils(tester=self.tester, destpath=self.destpath, time_per_gig=self.time_per_gig, work_component=self.component)
     self.group = group 
     self.keypair = keypair
     self.zonelist = []
     self.emi = self.tester.get_emi(emi)
     self.image_path = image_path
     self.emi_location = emi_location
     if zone is not None:
         self.zonelist.append(zone)
     self.testvolcount = testvolcount
     self.testvolumes = testvolumes
     self.authports=authports
     self.instance_password = instance_password
     self.vmtype= vmtype 
     self.user_data = user_data
     self.private_addressing = private_addressing
     #timeout for run instance command/test
     self.run_timeout=780 
     #setup zone list
     self.setupWindowsZones()
     #setup windows proxy 
     self.win_proxy_hostname = win_proxy_hostname
     self.proxy = None
     if win_proxy_hostname is not None:
         self.setup_proxy(win_proxy_hostname,
                          proxy_keypath = win_proxy_keypath,
                          proxy_username = win_proxy_username,
                          proxy_password = win_proxy_password,
                          debugmethod = lambda msg: self.debug(msg, traceback=2)
                          )
     self.setup_test_env()
     if self.instance and self.proxy:
             self.update_proxy_instance_data()