def takeSnapshotFromOnlyHost(self):
        all_failed= False
        is_inconsistent =  False
        snapshot_info_array = None
        self.logger.log('Taking Snapshot through Host')
        HandlerUtil.HandlerUtility.add_to_telemetery_data("snapshotCreator", "backupHostService")
        if self.g_fsfreeze_on :
            run_result, run_status = self.freeze()
        if(run_result == CommonVariables.success):
            snap_shotter = HostSnapshotter(self.logger)
            self.logger.log('T:S doing snapshot now...')
            time_before_snapshot = datetime.datetime.now()
            snapshot_info_array, all_failed, is_inconsistent, unable_to_sleep  = snap_shotter.snapshotall(self.para_parser, self.freezer, self.g_fsfreeze_on)
            time_after_snapshot = datetime.datetime.now()
            HandlerUtil.HandlerUtility.add_to_telemetery_data("snapshotTimeTaken", str(time_after_snapshot-time_before_snapshot))
            self.logger.log('T:S snapshotall ends...', True)
            if(all_failed or self.check_snapshot_array_fail(snapshot_info_array)):
                run_result = CommonVariables.FailedRetryableSnapshotFailedNoNetwork
                run_status = 'error'
                if self.takeSnapshotFrom == CommonVariables.onlyHost:
                    self.hutil.SetExtErrorCode(ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.FailedRetryableSnapshotFailedNoNetwork)
                    error_msg = error_msg + ExtensionErrorCodeHelper.ExtensionErrorCodeHelper.StatusCodeStringBuilder(self.hutil.ExtErrorCode)
                error_msg = 'Enable failed in taking snapshot through host'
                self.logger.log("T:S " + error_msg, True)

        return run_result, run_status, snapshot_info_array, all_failed
Esempio n. 2
0
    def takeSnapshotFromOnlyHost(self):
        run_result = CommonVariables.success
        run_status = 'success'
        all_failed = False
        is_inconsistent = False
        blob_snapshot_info_array = None
        self.logger.log('Taking Snapshot through Host')
        HandlerUtil.HandlerUtility.add_to_telemetery_data(
            CommonVariables.snapshotCreator, CommonVariables.backupHostService)

        if self.g_fsfreeze_on:
            run_result, run_status = self.freeze()
        if (run_result == CommonVariables.success):
            snap_shotter = HostSnapshotter(self.logger, self.hostIp)
            self.logger.log('T:S doing snapshot now...')
            time_before_snapshot = datetime.datetime.now()
            blob_snapshot_info_array, all_failed, is_inconsistent, unable_to_sleep = snap_shotter.snapshotall(
                self.para_parser, self.freezer, self.g_fsfreeze_on,
                self.taskId)
            time_after_snapshot = datetime.datetime.now()
            HandlerUtil.HandlerUtility.add_to_telemetery_data(
                "snapshotTimeTaken",
                str(time_after_snapshot - time_before_snapshot))
            self.logger.log('T:S snapshotall ends...', True)

        return run_result, run_status, blob_snapshot_info_array, all_failed
Esempio n. 3
0
    def takeSnapshotFromOnlyHost(self):
        all_failed= False
        is_inconsistent =  False
        snapshot_info_array = None
        self.logger.log('Taking Snapshot through Host')
        HandlerUtil.HandlerUtility.add_to_telemetery_data("snapshotCreator", "backupHostService")
        if self.g_fsfreeze_on :
            run_result, run_status = self.freeze()
        if(run_result == CommonVariables.success):
            snap_shotter = HostSnapshotter(self.logger)
            self.logger.log('T:S doing snapshot now...')
            time_before_snapshot = datetime.datetime.now()
            snapshot_info_array, all_failed, is_inconsistent, unable_to_sleep  = snap_shotter.snapshotall(self.para_parser, self.freezer, self.g_fsfreeze_on)
            time_after_snapshot = datetime.datetime.now()
            HandlerUtil.HandlerUtility.add_to_telemetery_data("snapshotTimeTaken", str(time_after_snapshot-time_before_snapshot))
            self.logger.log('T:S snapshotall ends...', True)
            if(all_failed or self.check_snapshot_array_fail(snapshot_info_array)):
                run_result = CommonVariables.FailedRetryableSnapshotFailedNoNetwork
                run_status = 'error'
                if self.takeSnapshotFrom == CommonVariables.onlyHost:
                    self.hutil.SetExtErrorCode(ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.FailedRetryableSnapshotFailedNoNetwork)
                    error_msg = error_msg + ExtensionErrorCodeHelper.ExtensionErrorCodeHelper.StatusCodeStringBuilder(self.hutil.ExtErrorCode)
                error_msg = 'Enable failed in taking snapshot through host'
                self.logger.log("T:S " + error_msg, True)

        return run_result, run_status, snapshot_info_array, all_failed
Esempio n. 4
0
    def takeSnapshotFromOnlyHost(self):
        run_result = CommonVariables.success
        run_status = 'success'
        all_failed = False
        is_inconsistent = False
        unable_to_sleep = False
        blob_snapshot_info_array = None
        self.logger.log('Taking Snapshot through Host')
        HandlerUtil.HandlerUtility.add_to_telemetery_data(
            CommonVariables.snapshotCreator, CommonVariables.backupHostService)

        if self.g_fsfreeze_on:
            run_result, run_status = self.freeze()

        if (self.para_parser is not None
                and self.is_command_timedout(self.para_parser) == True):
            self.hutil.SetExtErrorCode(
                ExtensionErrorCodeHelper.ExtensionErrorCodeEnum.
                FailedGuestAgentInvokedCommandTooLate)
            run_result = CommonVariables.FailedGuestAgentInvokedCommandTooLate
            run_status = 'error'
            all_failed = True
            self.logger.log(
                'T:S takeSnapshotFromOnlyHost : Thawing as failing due to CRP timeout',
                True, 'Error')
            self.freezer.thaw_safe()
        elif (run_result == CommonVariables.success
              or self.takeCrashConsistentSnapshot == True):
            snap_shotter = HostSnapshotter(self.logger, self.hostIp)
            self.logger.log('T:S doing snapshot now...')
            time_before_snapshot = datetime.datetime.now()
            blob_snapshot_info_array, all_failed, is_inconsistent, unable_to_sleep = snap_shotter.snapshotall(
                self.para_parser, self.freezer, self.g_fsfreeze_on,
                self.taskId)
            time_after_snapshot = datetime.datetime.now()
            snapshotTimeTaken = time_after_snapshot - time_before_snapshot
            self.logger.log('T:S takeSnapshotFromHost, time_before_snapshot=' +
                            str(time_before_snapshot) +
                            ", time_after_snapshot=" +
                            str(time_after_snapshot) + ", snapshotTimeTaken=" +
                            str(snapshotTimeTaken))
            HandlerUtil.HandlerUtility.add_to_telemetery_data(
                "snapshotTimeTaken", str(snapshotTimeTaken))
            self.logger.log('T:S snapshotall ends...', True)

        return run_result, run_status, blob_snapshot_info_array, all_failed, unable_to_sleep, is_inconsistent
    def takeSnapshotFromOnlyHost(self):
        run_result = CommonVariables.success
        run_status = 'success'
        all_failed= False
        is_inconsistent =  False
        blob_snapshot_info_array = None
        self.logger.log('Taking Snapshot through Host')
        HandlerUtil.HandlerUtility.add_to_telemetery_data(CommonVariables.snapshotCreator, CommonVariables.backupHostService)

        if self.g_fsfreeze_on :
            run_result, run_status = self.freeze()
        if(run_result == CommonVariables.success):
            snap_shotter = HostSnapshotter(self.logger, self.hostIp)
            self.logger.log('T:S doing snapshot now...')
            time_before_snapshot = datetime.datetime.now()
            blob_snapshot_info_array, all_failed, is_inconsistent, unable_to_sleep  = snap_shotter.snapshotall(self.para_parser, self.freezer, self.g_fsfreeze_on, self.taskId)
            time_after_snapshot = datetime.datetime.now()
            HandlerUtil.HandlerUtility.add_to_telemetery_data("snapshotTimeTaken", str(time_after_snapshot-time_before_snapshot))
            self.logger.log('T:S snapshotall ends...', True)

        return run_result, run_status, blob_snapshot_info_array, all_failed