Ejemplo n.º 1
0
    def _async_migrate(self, asyncjob,
                       origvm, origdconn, migrate_uri, rate, live,
                       secure, max_downtime):
        meter = asyncjob.get_meter()

        srcconn = util.dup_conn(origvm.conn)
        dstconn = util.dup_conn(origdconn)

        vminst = srcconn.vmm.lookupByName(origvm.get_name())
        vm = vmmDomain(srcconn, vminst, vminst.UUID())

        logging.debug("Migrating vm=%s from %s to %s", vm.get_name(),
                      srcconn.get_uri(), dstconn.get_uri())

        timer = None
        if max_downtime != 0:
            # 0 means that the spin box migrate-max-downtime does not
            # be enabled.
            current_thread = threading.currentThread()
            timer = self.timeout_add(100, self._async_set_max_downtime,
                                     vm, max_downtime, current_thread)

        vm.migrate(dstconn, migrate_uri, rate, live, secure, meter=meter)
        if timer:
            self.idle_add(gobject.source_remove, timer)
Ejemplo n.º 2
0
    def _async_migrate(self, asyncjob,
                       origvm, origdconn, migrate_uri, rate, live,
                       secure, max_downtime):
        meter = asyncjob.get_meter()

        srcconn = util.dup_conn(origvm.conn)
        dstconn = util.dup_conn(origdconn)

        vminst = srcconn.vmm.lookupByName(origvm.get_name())
        vm = vmmDomain(srcconn, vminst, vminst.UUID())

        logging.debug("Migrating vm=%s from %s to %s", vm.get_name(),
                      srcconn.get_uri(), dstconn.get_uri())

        timer = None
        if max_downtime != 0:
            # 0 means that the spin box migrate-max-downtime does not
            # be enabled.
            current_thread = threading.currentThread()
            timer = self.timeout_add(100, self._async_set_max_downtime,
                                     vm, max_downtime, current_thread)

        vm.migrate(dstconn, migrate_uri, rate, live, secure, meter=meter)
        if timer:
            self.idle_add(GLib.source_remove, timer)
Ejemplo n.º 3
0
    def do_install(self, asyncjob, activate):
        meter = asyncjob.get_meter()

        self.interface.conn = util.dup_conn(self.conn).vmm

        self.interface.install(meter, create=activate)
        logging.debug("Install completed")
Ejemplo n.º 4
0
    def _async_delete(self, asyncjob, paths):
        newconn = None
        storage_errors = []
        details = ""

        try:
            if self.vm.is_active():
                logging.debug("Forcing VM '%s' power off.", self.vm.get_name())
                self.vm.destroy()

            # Open a seperate connection to install on since this is async
            logging.debug("Threading off connection to delete vol.")
            newconn = util.dup_conn(self.conn).vmm
            meter = asyncjob.get_meter()

            for path in paths:
                try:
                    logging.debug("Deleting path: %s", path)
                    meter.start(text=_("Deleting path '%s'") % path)
                    self._async_delete_path(newconn, path, meter)
                except Exception, e:
                    storage_errors.append((str(e),
                                          "".join(traceback.format_exc())))
                meter.end(0)

            logging.debug("Removing VM '%s'", self.vm.get_name())
            self.vm.delete()
Ejemplo n.º 5
0
    def do_install(self, asyncjob, activate):
        meter = asyncjob.get_meter()

        self.interface.conn = util.dup_conn(self.conn).vmm

        self.interface.install(meter, create=activate)
        logging.debug("Install completed")
    def _async_vol_create(self, asyncjob):
        newconn = util.dup_conn(self.conn).vmm

        # Lookup different pool obj
        newpool = newconn.storagePoolLookupByName(self.parent_pool.get_name())
        self.vol.pool = newpool

        meter = asyncjob.get_meter()
        logging.debug("Starting backround vol creation.")
        self.vol.install(meter=meter)
        logging.debug("vol creation complete.")
Ejemplo n.º 7
0
    def _async_vol_create(self, asyncjob):
        newconn = util.dup_conn(self.conn).vmm

        # Lookup different pool obj
        newpool = newconn.storagePoolLookupByName(self.parent_pool.get_name())
        self.vol.pool = newpool

        meter = asyncjob.get_meter()
        logging.debug("Starting backround vol creation.")
        self.vol.install(meter=meter)
        logging.debug("vol creation complete.")
Ejemplo n.º 8
0
    def _async_clone(self, asyncjob):
        newconn = None

        try:
            self.orig_vm.set_cloning(True)

            # Open a seperate connection to install on since this is async
            logging.debug("Threading off connection to clone VM.")
            newconn = util.dup_conn(self.conn).vmm
            meter = asyncjob.get_meter()

            self.clone_design.orig_connection = newconn
            for d in self.clone_design.clone_virtual_disks:
                d.conn = newconn

            self.clone_design.setup()
            CloneManager.start_duplicate(self.clone_design, meter)
        finally:
            self.orig_vm.set_cloning(False)
Ejemplo n.º 9
0
    def _async_clone(self, asyncjob):
        newconn = None

        try:
            self.orig_vm.set_cloning(True)

            # Open a seperate connection to install on since this is async
            logging.debug("Threading off connection to clone VM.")
            newconn = util.dup_conn(self.conn).vmm
            meter = asyncjob.get_meter()

            self.clone_design.orig_connection = newconn
            for d in self.clone_design.clone_virtual_disks:
                d.conn = newconn

            self.clone_design.setup()
            CloneManager.start_duplicate(self.clone_design, meter)
        finally:
            self.orig_vm.set_cloning(False)
Ejemplo n.º 10
0
    def _async_delete(self, asyncjob, paths):
        newconn = None
        storage_errors = []
        details = ""

        try:
            # Open a seperate connection to install on since this is async
            logging.debug("Threading off connection to delete vol.")
            newconn = util.dup_conn(self.conn).vmm
            meter = asyncjob.get_meter()

            for path in paths:
                try:
                    logging.debug("Deleting path: %s", path)
                    meter.start(text=_("Deleting path '%s'") % path)
                    self._async_delete_path(newconn, path, meter)
                except Exception, e:
                    storage_errors.append((str(e), "".join(traceback.format_exc())))
                meter.end(0)

            logging.debug("Removing VM '%s'", self.vm.get_name())
            self.vm.delete()
Ejemplo n.º 11
0
 def cb():
     newconn = util.dup_conn(conn)
     newconn.restore(path)
Ejemplo n.º 12
0
    def _save_callback(self, asyncjob, vm, file_to_save):
        conn = util.dup_conn(vm.conn)
        newvm = conn.get_vm(vm.get_uuid())
        meter = asyncjob.get_meter()

        newvm.save(file_to_save, meter=meter)
Ejemplo n.º 13
0
 def cb():
     newconn = util.dup_conn(conn)
     newconn.restore(path)
Ejemplo n.º 14
0
    def _save_callback(self, asyncjob, vm, file_to_save):
        conn = util.dup_conn(vm.conn)
        newvm = conn.get_vm(vm.get_uuid())
        meter = asyncjob.get_meter()

        newvm.save(file_to_save, meter=meter)