Commit 34fbc862 authored by Andrea Spadaccini's avatar Andrea Spadaccini
Browse files

Migration: warn the user about hv version mismatch



* hv_kvm.py, hv_xen.py
  - return the hypervisor version (if available) from GetNodeInfo

* cmdlib.py
  - if hypervisor version is available during the migration, and the
    versions differ, warn the user
Signed-off-by: default avatarAndrea Spadaccini <spadaccio@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 3e40b587
......@@ -443,6 +443,7 @@ def GetNodeInfo(vgname, hypervisor_type):
- memory_dom0 is the memory allocated for domain0 in MiB
- memory_free is the currently available (free) ram in MiB
- memory_total is the total number of ram in MiB
- hv_version: the hypervisor version, if available
"""
outputarray = {}
......
......@@ -7343,6 +7343,21 @@ class TLMigrateInstance(Tasklet):
target_node = self.target_node
source_node = self.source_node
# Check for hypervisor version mismatch and warn the user.
nodeinfo = self.rpc.call_node_info([source_node, target_node],
None, self.instance.hypervisor)
src_info = nodeinfo[source_node]
dst_info = nodeinfo[target_node]
if ((constants.HV_NODEINFO_KEY_VERSION in src_info.payload) and
(constants.HV_NODEINFO_KEY_VERSION in dst_info.payload)):
src_version = src_info.payload[constants.HV_NODEINFO_KEY_VERSION]
dst_version = dst_info.payload[constants.HV_NODEINFO_KEY_VERSION]
if src_version != dst_version:
self.feedback_fn("* warning: hypervisor version mismatch between"
" source (%s) and target (%s) node" %
(src_version, dst_version))
self.feedback_fn("* checking disk consistency between source and target")
for dev in instance.disks:
if not _CheckDiskConsistency(self.lu, dev, target_node, False):
......
......@@ -776,6 +776,9 @@ HVS_PARAMETER_TYPES = {
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
# Node info keys
HV_NODEINFO_KEY_VERSION = "hv_version"
# Backend parameter names
BE_MEMORY = "memory"
BE_VCPUS = "vcpus"
......
......@@ -1541,15 +1541,18 @@ class KVMHypervisor(hv_base.BaseHypervisor):
def GetNodeInfo(self):
"""Return information about the node.
This is just a wrapper over the base GetLinuxNodeInfo method.
@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
- hv_version: the hypervisor version in the form (major, minor,
revision)
"""
return self.GetLinuxNodeInfo()
result = self.GetLinuxNodeInfo()
_, v_major, v_min, v_rev = self._GetKVMVersion()
result[constants.HV_NODEINFO_KEY_VERSION] = (v_major, v_min, v_rev)
return result
@classmethod
def GetInstanceConsole(cls, instance, hvparams, beparams):
......
......@@ -257,6 +257,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
- nr_cpus: total number of CPUs
- nr_nodes: in a NUMA system, the number of domains
- nr_sockets: the number of physical CPU sockets in the node
- hv_version: the hypervisor version in the form (major, minor)
"""
# note: in xen 3, memory has changed to total_memory
......@@ -269,6 +270,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
xmoutput = result.stdout.splitlines()
result = {}
cores_per_socket = threads_per_core = nr_cpus = None
xen_major, xen_minor = None, None
for line in xmoutput:
splitfields = line.split(":", 1)
......@@ -287,6 +289,10 @@ class XenHypervisor(hv_base.BaseHypervisor):
cores_per_socket = int(val)
elif key == "threads_per_core":
threads_per_core = int(val)
elif key == "xen_major":
xen_major = int(val)
elif key == "xen_minor":
xen_minor = int(val)
if (cores_per_socket is not None and
threads_per_core is not None and nr_cpus is not None):
......@@ -296,6 +302,9 @@ class XenHypervisor(hv_base.BaseHypervisor):
if dom0_info is not None:
result["memory_dom0"] = dom0_info[2]
if not (xen_major is None or xen_minor is None):
result[constants.HV_NODEINFO_KEY_VERSION] = (xen_major, xen_minor)
return result
@classmethod
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment