Support 'viridian' parameter in Xen HVM
[ganeti-local] / lib / hypervisor / hv_chroot.py
index 5b26e8b..5d88447 100644 (file)
@@ -29,9 +29,10 @@ import time
 import logging
 
 from ganeti import constants
-from ganeti import errors # pylint: disable-msg=W0611
+from ganeti import errors # pylint: disable=W0611
 from ganeti import utils
 from ganeti import objects
+from ganeti import pathutils
 from ganeti.hypervisor import hv_base
 from ganeti.errors import HypervisorError
 
@@ -58,7 +59,7 @@ class ChrootManager(hv_base.BaseHypervisor):
     - instance alive check is based on whether any process is using the chroot
 
   """
-  _ROOT_DIR = constants.RUN_GANETI_DIR + "/chroot-hypervisor"
+  _ROOT_DIR = pathutils.RUN_DIR + "/chroot-hypervisor"
 
   PARAMETERS = {
     constants.HV_INIT_SCRIPT: (True, utils.IsNormAbsPath,
@@ -135,7 +136,7 @@ class ChrootManager(hv_base.BaseHypervisor):
         data.append((file_name, 0, 0, 0, 0, 0))
     return data
 
-  def StartInstance(self, instance, block_devices):
+  def StartInstance(self, instance, block_devices, startup_paused):
     """Start an instance.
 
     For the chroot manager, we try to mount the block device and
@@ -233,6 +234,18 @@ class ChrootManager(hv_base.BaseHypervisor):
     raise HypervisorError("The chroot manager doesn't implement the"
                           " reboot functionality")
 
+  def BalloonInstanceMemory(self, instance, mem):
+    """Balloon an instance memory to a certain value.
+
+    @type instance: L{objects.Instance}
+    @param instance: instance to be accepted
+    @type mem: int
+    @param mem: actual memory size to use for instance runtime
+
+    """
+    # Currently chroots don't have memory limits
+    pass
+
   def GetNodeInfo(self):
     """Return information about the node.
 
@@ -247,7 +260,7 @@ class ChrootManager(hv_base.BaseHypervisor):
     return self.GetLinuxNodeInfo()
 
   @classmethod
-  def GetInstanceConsole(cls, instance, # pylint: disable-msg=W0221
+  def GetInstanceConsole(cls, instance, # pylint: disable=W0221
                          hvparams, beparams, root_dir=None):
     """Return information for connecting to the console of an instance.
 
@@ -260,7 +273,7 @@ class ChrootManager(hv_base.BaseHypervisor):
     return objects.InstanceConsole(instance=instance.name,
                                    kind=constants.CONS_SSH,
                                    host=instance.primary_node,
-                                   user=constants.GANETI_RUNAS,
+                                   user=constants.SSH_CONSOLE_USER,
                                    command=["chroot", root_dir])
 
   def Verify(self):
@@ -268,9 +281,13 @@ class ChrootManager(hv_base.BaseHypervisor):
 
     For the chroot manager, it just checks the existence of the base dir.
 
+    @return: Problem description if something is wrong, C{None} otherwise
+
     """
-    if not os.path.exists(self._ROOT_DIR):
-      return "The required directory '%s' does not exist." % self._ROOT_DIR
+    if os.path.exists(self._ROOT_DIR):
+      return None
+    else:
+      return "The required directory '%s' does not exist" % self._ROOT_DIR
 
   @classmethod
   def PowercycleNode(cls):
@@ -291,3 +308,16 @@ class ChrootManager(hv_base.BaseHypervisor):
 
     """
     raise HypervisorError("Migration not supported by the chroot hypervisor")
+
+  def GetMigrationStatus(self, instance):
+    """Get the migration status
+
+    @type instance: L{objects.Instance}
+    @param instance: the instance that is being migrated
+    @rtype: L{objects.MigrationStatus}
+    @return: the status of the current migration (one of
+             L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional
+             progress info that can be retrieved from the hypervisor
+
+    """
+    raise HypervisorError("Migration not supported by the chroot hypervisor")