Пример #1
0
    def backup_vm(self,
                  vm,
                  dest,
                  tp=0,
                  level="low",
                  descr="",
                  baktype="manul"):
        params = {}

        params['vmUuid'] = vm.get_vmUuid()
        params['uuid'] = vm.get_storage_uuid()
        params['parentUuid'] = vm.get_parentUuid()
        params['storage_path'] = vm.get_storage_path()
        params['copy_Level'] = level
        params['bakdsc'] = descr
        params['baktype'] = baktype

        if vm.host.get_storage_path(dest):
            params['targetstorage_path'] = vm.host.get_storage_path(dest)
        else:
            raise error.CommonError("Target storage does not exist.")
        if not tp:
            params['backup_type'] = "diff_backup"
        elif tp == 1:
            params['backup_type'] = "complete_backup"

        action_id = CODE['backup_vm']
        host = vm.get_hostname()
        m_id = self.executor.run(action_id, params, host, 'vm',
                                 'VmnoclusterchangeTask')

        self.executor.wait_for_done(m_id, host, timeout=1800)
Пример #2
0
 def backup_vm(self, vm, dest, tp=0, level="low", 
               descr="", baktype="manul"):
     params = {}
     
     params['vmUuid'] = vm.get_vmUuid()
     params['uuid'] = vm.get_storage_uuid()
     params['parentUuid'] = vm.get_parentUuid()
     params['storage_path'] = vm.get_storage_path()
     params['copy_Level'] = level
     params['bakdsc'] = descr
     params['baktype'] = baktype
     
     if vm.host.get_storage_path(dest):
         params['targetstorage_path'] = vm.host.get_storage_path(dest)
     else:
         raise error.CommonError("Target storage does not exist.")
     if not tp:
         params['backup_type'] = "diff_backup"
     elif tp == 1:
         params['backup_type'] = "complete_backup"
     
     action_id = CODE['backup_vm']
     host = vm.get_hostname()
     m_id = self.executor.run(action_id, params, host, 'vm',
                              'VmnoclusterchangeTask')
     
     self.executor.wait_for_done(m_id, host, timeout=1800)
Пример #3
0
    def recover_snapshot(self, vm, sn):
        params = {}
        params.update(vmd_port.RECOVER_SNAPSHOT)

        params['parentUuid'] = vm.get_parentUuid()
        params['storage_uuid'] = vm.get_storage_uuid()
        params['storage_path'] = vm.get_storage_path()
        params['vmUuid'] = vm.get_vmUuid()
        params['snuuid'] = sn
        host = vm.get_hostname()

        action_id = CODE['re_snapshot']
        m_id = self.executor.run(action_id, params, host, 'vm',
                                 'VmnoclusterchangeTask')
        self.executor.wait_for_done(m_id, host)
Пример #4
0
    def snapshot(self, vm, sname, desc=""):
        params = {}
        params.update(vmd_port.TAKE_SNAPSHOT)
        params['parentUuid'] = vm.get_parentUuid()
        params['storage_uuid'] = vm.get_storage_uuid()
        params['storage_path'] = vm.get_storage_path()
        params['vmUuid'] = vm.get_vmUuid()
        params['snname'] = sname
        params['sndesc'] = desc
        host = vm.get_hostname()

        action_id = CODE['snapshot']
        m_id = self.executor.run(action_id, params, host, 'vm',
                                 'VmnoclusterchangeTask')
        self.executor.wait_for_done(m_id, host)
Пример #5
0
 def recover_snapshot(self, vm, sn):
     params = {}
     params.update(vmd_port.RECOVER_SNAPSHOT)
     
     params['parentUuid'] = vm.get_parentUuid()
     params['storage_uuid'] = vm.get_storage_uuid()
     params['storage_path'] = vm.get_storage_path()
     params['vmUuid'] = vm.get_vmUuid()
     params['snuuid'] = sn
     host = vm.get_hostname()
     
     action_id = CODE['re_snapshot']
     m_id = self.executor.run(action_id, params, host, 'vm',
                              'VmnoclusterchangeTask')
     self.executor.wait_for_done(m_id, host)
Пример #6
0
 def snapshot(self, vm, sname, desc=""):
     params = {}
     params.update(vmd_port.TAKE_SNAPSHOT)
     params['parentUuid'] = vm.get_parentUuid()
     params['storage_uuid'] = vm.get_storage_uuid()
     params['storage_path'] = vm.get_storage_path()
     params['vmUuid'] = vm.get_vmUuid()
     params['snname'] = sname
     params['sndesc'] = desc
     host = vm.get_hostname()
     
     action_id = CODE['snapshot']
     m_id = self.executor.run(action_id, params, host, 'vm',
                              'VmnoclusterchangeTask')
     self.executor.wait_for_done(m_id, host)