Skip to contentSkip to conversation

xm, xend: Add new option "change_home_server" to xm migrate

RFC PATCH New Masaki Kanno 1 participant 1 message Oct 14, 2009

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 xm, xend: Add new option "change_home_server" to xm migrate

Hi,

This patch adds a new option to xm migrate command. A concept of the option is inspired from XenServer/XenCenter. The concept is "Change home server (affinity)."
The option name is "change_home_server."

Currently, a config.sxp file of a managed domain is not migrated to a destination server even if the migration of the managed domain succeeds. The config.sxp file is kept in a source server.

By the patch, the config.sxp file is migrated with the managed domain. The config.sxp file is unregistered from the source server, then the config.sxp file is registered to the destination server.

BTW, should the config.sxp file be always migrated without the option? If the managed domain is migrated without the option, the managed domains exist on both the source server and the destination server. (Of course, the managed domain on the source server is "halted" state, and the managed domain on the destination server is "running" state.) Is it good that the managed domains with a same UUID exist on both servers?
(In the patch, I added the option for compatible.)

Best regards,
Kan

tools/python/xen/xend/XendConfig.py +4 -0
diff -r 5d779377a9ae tools/python/xen/xend/XendConfig.py
@@ -957,6 +957,7 @@
         _set_cfg_if_exists('on_xend_stop')
         _set_cfg_if_exists('on_xend_start')
         _set_cfg_if_exists('vcpu_avail')
+        _set_cfg_if_exists('change_home_server')
         
         # Parse and store runtime configuration 
         _set_cfg_if_exists('start_time')
@@ -1158,6 +1159,9 @@
         if 'cpuid_check' in self:
             self.cpuid_to_sxp(sxpr, 'cpuid_check')
 
+        if self.has_key('change_home_server'):
+            sxpr.append(['change_home_server', self['change_home_server']])
+
         log.debug(sxpr)
 
         return sxpr    
tools/python/xen/xend/XendDomain.py +131 -101

277 lines not on this page · raw message

tools/python/xen/xend/XendDomainInfo.py +11 -2
diff -r 5d779377a9ae tools/python/xen/xend/XendDomainInfo.py
@@ -2357,6 +2357,13 @@
         return self.getDeviceController(deviceClass).recover_migrate(
                      deviceConfig, network, dst, step, domName)
 
+    def setChangeHomeServer(self, chs):
+        if chs is not None:
+            self.info['change_home_server'] = bool(chs)
+        else:
+            if self.info.has_key('change_home_server'):
+                del self.info['change_home_server']
+
 
     ## private:
 
@@ -2863,8 +2870,10 @@
         self._cleanup_phantom_devs(paths)
         self._cleanupVm()
 
-        if "transient" in self.info["other_config"] \
-           and bool(self.info["other_config"]["transient"]):
+        if ("transient" in self.info["other_config"] and \
+            bool(self.info["other_config"]["transient"])) or \
+           ("change_home_server" in self.info and \
+            bool(self.info["change_home_server"])):
             XendDomain.instance().domain_delete_by_dominfo(self)
 
 
tools/python/xen/xm/migrate.py +6 -1
diff -r 5d779377a9ae tools/python/xen/xm/migrate.py
@@ -51,6 +51,10 @@
           fn=set_true, default=None,
           use="Use ssl connection for migration.")
 
+gopts.opt('change_home_server', short='c',
+          fn=set_true, default=0,
+          use="Change home server for managed domains.")
+
 def help():
     return str(gopts)
     
@@ -78,4 +82,5 @@
         server.xend.domain.migrate(dom, dst, opts.vals.live,
                                    opts.vals.port,
                                    opts.vals.node,
-                                   opts.vals.ssl)
+                                   opts.vals.ssl,
+                                   opts.vals.change_home_server)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel