LUSetInstanceParams: save cluster
[ganeti-local] / lib / hypervisor / hv_xen.py
index c444cf0..6693c6b 100644 (file)
@@ -45,6 +45,11 @@ class XenHypervisor(hv_base.BaseHypervisor):
   REBOOT_RETRY_COUNT = 60
   REBOOT_RETRY_INTERVAL = 10
 
+  ANCILLARY_FILES = [
+    '/etc/xen/xend-config.sxp',
+    '/etc/xen/scripts/vif-bridge',
+    ]
+
   @classmethod
   def _WriteConfigFile(cls, instance, block_devices):
     """Write the Xen config file for the instance.
@@ -397,6 +402,23 @@ class XenHypervisor(hv_base.BaseHypervisor):
     except EnvironmentError:
       logging.exception("Failure while removing instance config file")
 
+  @classmethod
+  def PowercycleNode(cls):
+    """Xen-specific powercycle.
+
+    This first does a Linux reboot (which triggers automatically a Xen
+    reboot), and if that fails it tries to do a Xen reboot. The reason
+    we don't try a Xen reboot first is that the xen reboot launches an
+    external command which connects to the Xen hypervisor, and that
+    won't work in case the root filesystem is broken and/or the xend
+    daemon is not working.
+
+    """
+    try:
+      cls.LinuxPowercycle()
+    finally:
+      utils.RunCmd(["xm", "debug", "R"])
+
 
 class XenPvmHypervisor(XenHypervisor):
   """Xen PVM hypervisor interface"""
@@ -464,6 +486,9 @@ class XenPvmHypervisor(XenHypervisor):
 class XenHvmHypervisor(XenHypervisor):
   """Xen HVM hypervisor interface"""
 
+  ANCILLARY_FILES = XenHypervisor.ANCILLARY_FILES + \
+    [constants.VNC_PASSWORD_FILE]
+
   PARAMETERS = {
     constants.HV_ACPI: hv_base.NO_CHECK,
     constants.HV_BOOT_ORDER: (True, ) + \