Bootstrap: factor out and prepare shared-file-storage
[ganeti-local] / lib / hypervisor / hv_kvm.py
index 44a7151..14c5807 100644 (file)
@@ -529,6 +529,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     constants.HV_VGA: hv_base.NO_CHECK,
     constants.HV_KVM_EXTRA: hv_base.NO_CHECK,
     constants.HV_KVM_MACHINE_VERSION: hv_base.NO_CHECK,
+    constants.HV_VNET_HDR: hv_base.NO_CHECK,
     }
 
   _VIRTIO = "virtio"
@@ -1400,7 +1401,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
       kvm_cmd.extend(["-uuid", instance.uuid])
 
     if hvp[constants.HV_KVM_EXTRA]:
-      kvm_cmd.extend([hvp[constants.HV_KVM_EXTRA]])
+      kvm_cmd.extend(hvp[constants.HV_KVM_EXTRA].split(" "))
 
     # Save the current instance nics, but defer their expansion as parameters,
     # as we'll need to generate executable temp files for them.
@@ -1533,7 +1534,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
           devlist = self._GetKVMOutput(kvm_path, self._KVMOPT_DEVICELIST)
           if self._NEW_VIRTIO_RE.search(devlist):
             nic_model = self._VIRTIO_NET_PCI
-            vnet_hdr = True
+            vnet_hdr = up_hvp[constants.HV_VNET_HDR]
         except errors.HypervisorError, _:
           # Older versions of kvm don't support DEVICE_LIST, but they don't
           # have new virtio syntax either.
@@ -1894,12 +1895,14 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     else:
       self.StopInstance(instance, force=True)
 
-  def MigrateInstance(self, instance, target, live):
+  def MigrateInstance(self, cluster_name, instance, target, live):
     """Migrate an instance to a target node.
 
     The migration will not be attempted if the instance is not
     currently running.
 
+    @type cluster_name: string
+    @param cluster_name: name of the cluster
     @type instance: L{objects.Instance}
     @param instance: the instance to be migrated
     @type target: string
@@ -2001,10 +2004,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     @type hvparams: dict of strings
     @param hvparams: hypervisor parameters, not used in this class
 
-    @return: a dict with the following keys (values in MiB):
-          - memory_total: the total memory size on the node
-          - memory_free: the available memory on the node for instances
-          - memory_dom0: the memory used by the node itself, if available
+    @return: a dict as returned by L{BaseHypervisor.GetLinuxNodeInfo} plus
+        the following keys:
           - hv_version: the hypervisor version in the form (major, minor,
                         revision)
 
@@ -2018,7 +2019,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     return result
 
   @classmethod
-  def GetInstanceConsole(cls, instance, hvparams, beparams):
+  def GetInstanceConsole(cls, instance, primary_node, hvparams, beparams):
     """Return a command for connecting to the console of an instance.
 
     """
@@ -2030,7 +2031,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
              "UNIX-CONNECT:%s" % cls._InstanceSerial(instance.name)]
       return objects.InstanceConsole(instance=instance.name,
                                      kind=constants.CONS_SSH,
-                                     host=instance.primary_node,
+                                     host=primary_node.name,
                                      user=constants.SSH_CONSOLE_USER,
                                      command=cmd)