예제 #1
0
 def _trigger_mds_issue(cls, vpool, volume_bundle, target_storagerouter_guid, logger=LOGGER):
     """
     voldrv A, voldrv B, volume X op A
     ensure_safety lopen op X, die gaat master op A en slave op B hebben -> done on create
     dan ga je manueel tegen de voldrv zeggen dat X enkel nog A heeft als MDS
     B blijft dan slave, en blijft catchuppe
     dan scrub je X, en die raken niet applied op B
     want 'm kent die eigenlijk niet
     en dan - da's hier enigzinds nen educated guess - configureer je B manueel terug als slave
     doe je nen move of nen failover beter gezegd (zie hierboven hoe te doen)
     dan gaat 'm opeens B als master gebruiken maar die heeft geen scrub results applied
     """
     logger.debug('Starting the mds triggering.')
     cls._set_mds_safety(vpool, 2, checkup=True)  # Will trigger mds checkup which should create a slave again
     # Move the volume to set the slave as the master
     for vdisk_name, vdisk_object in volume_bundle.iteritems():
         VDiskSetup.move_vdisk(vdisk_guid=vdisk_object.guid, target_storagerouter_guid=target_storagerouter_guid)
예제 #2
0
 def _execute_test(cls, amount_vdisks=AMOUNT_VDISKS):
     """
     Executes a offline migration
     :param amount_vdisks: amount of vdisks to test
     :type amount_vdisks: int
     :return:
     """
     cls.LOGGER.info("Starting offline migrate test.")
     vpool = None  # Get a suitable vpool
     for vp in VPoolHelper.get_vpools():
         if len(vp.storagedrivers) >= 2:
             vpool = vp
             break
     assert vpool is not None, "Not enough vPools to test. Requires 1 with at least 2 storagedrivers and found 0."
     ##########################
     # Setup base information #
     ##########################
     # Executor storagedriver_1 is current system
     std_1 = random.choice([st for st in vpool.storagedrivers])
     # Get a random other storagedriver to migrate to
     std_2 = random.choice([st for st in vpool.storagedrivers if st != std_1])
     # Cache to validate properties
     values_to_check = {
         'source_std': std_1.serialize(),
         'target_std': std_2.serialize()
     }
     ###############################
     # start deploying & migrating #
     ###############################
     created_vdisks = []
     try:
         for i in xrange(amount_vdisks):
             ################
             # create vdisk #
             ################
             vdisk_name = "{0}_{1}".format(cls.TEST_NAME, i)
             try:
                 vdisk_guid = VDiskSetup.create_vdisk(vdisk_name=vdisk_name + '.raw',
                                                      vpool_name=vpool.name,
                                                      size=cls.AMOUNT_TO_WRITE * 5,
                                                      storagerouter_ip=std_1.storagerouter.ip)
                 vdisk = VDiskHelper.get_vdisk_by_guid(vdisk_guid)  # Fetch to validate if it was properly created
                 created_vdisks.append(vdisk)
                 values_to_check['vdisk'] = vdisk.serialize()
             except TimeOutError:
                 cls.LOGGER.error("Creation of the vdisk has timed out.")
                 raise
             except (RuntimeError, TimeOutError) as ex:
                 cls.LOGGER.info("Creation of vdisk failed: {0}".format(ex))
                 raise
             else:
                 time.sleep(cls.SLEEP_TIME)
                 try:
                     cls.LOGGER.info("Moving vdisk {0} from {1} to {2}".format(vdisk_guid, std_1.storage_ip, std_2.storage_ip))
                     VDiskSetup.move_vdisk(vdisk_guid=vdisk_guid, target_storagerouter_guid=std_2.storagerouter_guid)
                     time.sleep(cls.SLEEP_TIME)
                     cls.LOGGER.info("Validating move...")
                     cls._validate_move(values_to_check)
                 except Exception as ex:
                     cls.LOGGER.exception('Failed during migation: {0}'.format(ex))
                     raise
     finally:
         for vdisk in created_vdisks:
             VDiskRemover.remove_vdisk(vdisk.guid)
     cls.LOGGER.info("Finished offline migrate test.")