コード例 #1
0
 def negative_attach_in_use_volume_in_zones(self,zonelist=None,timeout=360):
     """
     Description:
                 Iterates though zones and attempts to attach already attached volumes to instances within each zone.  
     """
     zonelist = zonelist or self.zonelist
     if not zonelist:
         raise Exception("Zone list was empty")
     instance = euinstance.EuInstance()
     for zone in zonelist:
         tested = 0
         for volume in zone.volumes:
             volume.update()
             if (volume.status == "in-use"):
                 tested += 1
                 for instance in zone.instances:
                     try:
                         #This should fail
                         instance.attach_euvolume(volume,timeout=timeout)
                     except Exception, e:
                         #If it failed were good
                         self.debug("negative_attach_in_use_volume_in_zones Passed. Could not attach in-use volume")
                         #self.endsuccess()
                         pass
                     else:
                         #The operation did fail, but this test did
                         raise Exception("negative_attach_in_use_volume_in_zones failed volume attached")
         if not tested:
             raise Exception("No attached volumes found to test against")
コード例 #2
0
 def negative_attach_in_use_volume_in_zones(self,
                                            zonelist=None,
                                            timeout=360):
     testmsg = """
                 Iterates though zones and attempts to attach already attached volumes to instances within each zone.  
                 """
     testmsg = testmsg + "\nVariables provided:\nzonelist" + str(
         zonelist) + "\ntimeout:" + str(timeout)
     self.startmsg(testmsg)
     if zonelist is None:
         zonelist = self.zonelist
     instance = euinstance.EuInstance()
     for zone in zonelist:
         for volume in zone.volumes:
             volume.update()
             if (volume.status == "in-use"):
                 for instance in zone.instances:
                     try:
                         #This should fail
                         instance.attach_euvolume(volume, timeout=timeout)
                     except Exception, e:
                         #If it failed were good
                         self.debug(
                             "negative_attach_in_use_volume_in_zones Passed. Could not attach in-use volume"
                         )
                         self.endsuccess()
                         pass
                     else:
                         #The operation did fail, but this test did
                         raise Exception(
                             "negative_attach_in_use_volume_in_zones failed volume attached"
                         )
コード例 #3
0
ファイル: ebstests.py プロジェクト: anthony198/eutester
    def detach_volumes_in_zones(self, zonelist=None, timeout=90, volcount=1):
        testmsg = """
                    Attempts to detach volcount volumes from each instance in the provided zonelist. 
                    Attempts to verify detached volume state on both the cloud and the guest
                    by default will attempt to detach a single volume from each instance
                    """
        testmsg = testmsg + "\nVariables provided:\nzonelist:" + str(
            zonelist) + "\ntimeout:" + str(timeout) + "\nvolcount:" + str(
                volcount)

        self.startmsg(testmsg)
        if zonelist is None:
            zonelist = self.zonelist
        instance = euinstance.EuInstance()
        for zone in zonelist:
            for instance in zone.instances:
                vc = 0
                badvols = instance.get_unsynced_volumes()
                if (badvols is not None) and (badvols != []):
                    self.debug("failed")
                    raise Exception("Unsync volumes found on:" +
                                    str(instance.id) + "\n" + "".join(badvols))
                for volume in instance.attached_vols:
                    #detach number of volumes equal to volcount
                    if vc >= volcount:
                        break
                    else:
                        vc += 1
                        try:
                            instance.detach_euvolume(volume, timeout=timeout)
                        except Exception, e:
                            self.debug("fail. Could not detach Volume:" +
                                       str(volume.id) + "from instance:" +
                                       str(instance.id))
                            raise e
コード例 #4
0
ファイル: ebstests.py プロジェクト: anthony198/eutester
 def attach_all_avail_vols_to_instances_in_zones(self,
                                                 zonelist=None,
                                                 timeout=90):
     testmsg = """
                 Iterates though zones and attempts to attach volumes to instances within each zone.  
                 """
     testmsg = testmsg + "\nVariables provided:\nzonelist" + str(
         zonelist) + "\ntimeout:" + str(timeout)
     self.startmsg(testmsg)
     if zonelist is None:
         zonelist = self.zonelist
     instance = euinstance.EuInstance()
     for zone in zonelist:
         for volume in zone.volumes:
             volume.update()
             if (volume.status == "available"):
                 for instance in zone.instances:
                     try:
                         instance.attach_euvolume(volume, timeout=timeout)
                     except Exception, e:
                         self.debug(
                             "attach_all_vols_to_instances_in_zones failed to attach volume"
                         )
                         raise e
                 instance.vol_write_random_data_get_md5(volume,
                                                        timepergig=120)
コード例 #5
0
 def attach_new_vols_from_snap_verify_md5(self,zonelist=None, timeout=360,timepergig=360):
     testmsg =   """
                 Attempts to attach volumes which were created from snapshots and are not in use. 
                 After verifying the volume is attached and reported as so by cloud and guest, 
                 this test will attempt to compare the md5 sum of the volume to the md5 contained in 
                 the snapshot which represents the md5 of the original volume. 
                 This test accepts a timepergig value which is used to guesstimate a reasobale timeout while
                 waiting for the md5 operation to be executed. 
                 """
     testmsg = testmsg + "\nVariables provided:\nzonelist:"+str(zonelist)+"\ntimeout:"+str(timeout)+"\ntimepergig:"+str(timepergig)
     self.startmsg(testmsg)
     instance = euinstance.EuInstance()
     if zonelist is None:
         zonelist = self.zonelist
     for zone in zonelist:
         self.debug("checking zone:"+zone.name)
         #use a single instance per zone for this test
         instance = zone.instances[0]
         for snap in self.snaps:
             self.debug("Checking volumes associated with snap:"+snap.id)
             for vol in snap.new_vol_list:
                 self.debug("Checking volume:"+vol.id+" status:"+vol.status)
                 if (vol.zone == zone.name) and (vol.status == "available"):
                     instance.attach_euvolume(vol, timeout=timeout)
                     instance.md5_attached_euvolume(vol, timepergig=timepergig)
                     if vol.md5 != snap.md5:
                         self.debug("snap:"+str(snap.md5)+" vs vol:"+str(vol.md5))
                         self.debug("Volume:"+str(vol.id)+" MD5:"+str(vol.md5)+" != Snap:"+str(snap.id)+" MD5:"+str(snap.md5))
                         raise Exception("Volume:"+str(vol.id)+" MD5:"+str(vol.md5)+" != Snap:"+str(snap.id)+" MD5:"+str(snap.md5))
                     self.debug("Successfully verified volume:"+str(vol.id)+" to snapshot:"+str(snap.id))
     self.endsuccess()
コード例 #6
0
 def terminate_instances_in_zones_verify_volume_detach(self,zonelist=None,timeout=360):
     """
     Description:
               Iterates over all instances in this testcase's zonelist attempts to terminate the instances,
               and verify the attached volumes go to available after the instances are terminated. 
     """
     instance = euinstance.EuInstance()
     zonelist = zonelist or self.zonelist
     if not zonelist:
         raise Exception("Zone list was empty")
     for zone in zonelist:
         for instance in zone.instances:
             instance.terminate_and_verify(verify_vols=True,timeout=timeout)
             zone.instances.remove(instance)
コード例 #7
0
 def reboot_instances_in_zone_verify_volumes(self,zonelist=None,waitconnect=30, timeout=360):
     testmsg =   """
                 Attempts to iterate through each instance in each zone and reboot the instance(s). 
                 Attempts to verify the attached volume state post reboot. 
                 """
     testmsg = testmsg + "\nVariables Provided:\nzonelist:"+str(zonelist)+"\nwaitconnect:"+str(waitconnect)+"\ntimeout:"+str(timeout)
     self.startmsg(testmsg)
     if zonelist is None:
         zonelist = self.zonelist
     instance = euinstance.EuInstance()
     for zone in zonelist:
         for instance in zone.instances:
             instance.reboot_instance_and_verify(waitconnect=waitconnect, timeout=timeout, checkvolstatus=True)
     self.endsuccess()
コード例 #8
0
 def reboot_instances_in_zone_verify_volumes(self,zonelist=None,waitconnect=30, timeout=360):
     """
     Description:
                 Attempts to iterate through each instance in each zone and reboot the instance(s). 
                 Attempts to verify the attached volume state post reboot. 
     """
     zonelist = zonelist or self.zonelist
     if not zonelist:
         raise Exception("Zone list was empty")
     instance = euinstance.EuInstance()
     for zone in zonelist:
         if not zone.instances:
             raise Exception("No instances in zone:"+str(zone.name))
         for instance in zone.instances:
             instance.reboot_instance_and_verify(waitconnect=waitconnect, timeout=timeout, checkvolstatus=True)
コード例 #9
0
ファイル: ebstests.py プロジェクト: anthony198/eutester
 def negative_delete_attached_volumes_in_zones(self,
                                               zonelist=None,
                                               timeout=60):
     testmsg = """
                 Attempts to delete attached volumes, this is a negative test as this should fail. 
                 """
     testmsg = testmsg + "\nVariables provided:\nzonelist:" + str(
         zonelist) + "\ntimeout:" + str(timeout)
     self.startmsg(testmsg)
     if zonelist is None:
         zonelist = self.zonelist
     instance = euinstance.EuInstance()
     volume = euvolume.EuVolume()
     for zone in zonelist:
         for instance in zone.instances:
             badvols = instance.get_unsynced_volumes()
             if (badvols is not None) and (badvols != []):
                 self.debug(
                     "negative_delete_attached_volumes_in_zones, failed")
                 raise Exception("Unsync volumes found on:" +
                                 str(instance.id) + "\n" + "".join(badvols))
             for volume in instance.attached_vols:
                 try:
                     volume.delete()
                 except:
                     self.debug(
                         "Success- could not delete attached volume:" +
                         str(volume.id))
                 else:
                     volume.update()
                     if (volume.status == "deleted"):
                         self.debug(
                             "negative_delete_attached_volumes_in_zones, failed:"
                             + str(volume.id))
                         raise Exception(
                             "Was able to delete attached volume:" +
                             str(volume.id))
     self.endsuccess()