Beispiel #1
0
    def run(self):
        """Main function for test case execution"""
        log = logger.get_log()

        try:
            log.info("Started executing {0} testcase".format(self.id))
            log.info("-" * 25 + " Initialize helper objects " + "-" * 25)
            auto_commcell = VirtualServerHelper.AutoVSACommcell(
                self.commcell, self.csdb)
            auto_client = VirtualServerHelper.AutoVSAVSClient(
                auto_commcell, self.client)
            auto_instance = VirtualServerHelper.AutoVSAVSInstance(
                auto_client, self.agent, self.instance)
            auto_instance.vm_user_name = self.tcinputs['VMUserName']
            auto_instance.vm_password = self.tcinputs['VMPassword']
            auto_backupset = VirtualServerHelper.AutoVSABackupset(
                auto_instance, self.backupset)
            auto_subclient = VirtualServerHelper.AutoVSASubclient(
                auto_backupset, self.subclient)

            log.info("-" * 25 + " Backup " + "-" * 25)
            backup_options = OptionsHelper.BackupOptions(auto_subclient)
            auto_subclient.backup(backup_options)

            log.info("-" * 25 + " Files restores " + "-" * 25)
            file_restore_options = OptionsHelper.FileLevelRestoreOptions(
                auto_subclient)
            auto_subclient.guest_file_restore(file_restore_options)

            log.info("-" * 25 + " Disk restores " + "-" * 25)
            disk_restore_options = OptionsHelper.DiskRestoreOptions(
                auto_subclient)
            #auto_subclient.disk_restore(disk_restore_options)

            log.info("-" * 15 + " FULL VM out of Place restores " + "-" * 15)
            vm_restore_options = OptionsHelper.FullVMRestoreOptions(
                auto_subclient, self)
            #auto_subclient.disk_restore(vm_restore_options)

        except Exception as exp:
            log.error('Failed with error: ' + str(exp))
            self.result_string = str(exp)
            self.status = constants.FAILED
Beispiel #2
0
    def run(self):
        """Main function for test case execution"""
        log = logger.get_log()

        try:
            log.info("Started executing {0} testcase".format(self.id))

            log.info(
                "-------------------Initialize helper objects------------------------------------"
            )
            auto_commcell = VirtualServerHelper.AutoVSACommcell(
                self.commcell, self.csdb)
            auto_client = VirtualServerHelper.AutoVSAVSClient(
                auto_commcell, self.client)
            auto_instance = VirtualServerHelper.AutoVSAVSInstance(
                auto_client, self.agent, self.instance)
            auto_backupset = VirtualServerHelper.AutoVSABackupset(
                auto_instance, self.backupset)
            auto_subclient = VirtualServerHelper.AutoVSASubclient(
                auto_backupset, self.subclient)

            # """
            log.info(
                "----------------------------------------Backup-----------------------------------"
            )
            backup_options = OptionsHelper.BackupOptions(auto_subclient)
            auto_subclient.backup(backup_options)

            # """

            # """

            log.info(
                "----------------------------------------File Level restores---------------------"
            )
            fs_restore_options = OptionsHelper.FileLevelRestoreOptions(
                auto_subclient)
            fs_restore_options.fbr_ma = self.tcinputs["FBRMA"]
            auto_subclient.guest_file_restore(fs_restore_options)

            # """
            # """
            log.info(
                "----------------------------------------Disk restores----------------------------"
            )
            disk_restore_options = OptionsHelper.DiskRestoreOptions(
                auto_subclient)
            auto_subclient.disk_restore(disk_restore_options)

            # """
            # """
            log.info(
                "----------------------------------------FULL VM out of Place restores------------"
            )
            vm_restore_options = OptionsHelper.FullVMRestoreOptions(
                auto_subclient, self)
            vm_restore_options.unconditional_overwrite = True
            auto_subclient.virtual_machine_restore(vm_restore_options)

            # """
            # """
            log.info(
                "----------------------------------------FULL VM in  Place restores---------------"
            )
            vm_restore_options = OptionsHelper.FullVMRestoreOptions(
                auto_subclient, self)
            vm_restore_options.power_on_after_restore = True
            vm_restore_options.in_place_overwrite = True
            auto_subclient.virtual_machine_restore(vm_restore_options)

            # """

        except Exception as exp:
            log.error('Failed with error: ' + str(exp))
            self.result_string = str(exp)
            self.status = constants.FAILED