|
|
5cef56 |
From 6024403e02643db81555e3333463b2f0e1b206b5 Mon Sep 17 00:00:00 2001
|
|
|
5cef56 |
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
5cef56 |
Date: Thu, 29 Aug 2013 17:18:50 +0200
|
|
|
5cef56 |
Subject: [PATCH 09/48] VSSD: Add properties for arch and machine
|
|
|
5cef56 |
|
|
|
5cef56 |
For architectures like s390 the machine type is relevant for
|
|
|
5cef56 |
the proper guest construction. We add the necessary properties
|
|
|
5cef56 |
to the schema and the C structures and the necessary code
|
|
|
5cef56 |
for CIM-to-libvirt mapping.
|
|
|
5cef56 |
|
|
|
5cef56 |
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
5cef56 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
5cef56 |
---
|
|
|
5cef56 |
libxkutil/device_parsing.c | 12 ++++++++++++
|
|
|
5cef56 |
libxkutil/device_parsing.h | 2 ++
|
|
|
5cef56 |
libxkutil/xmlgen.c | 6 ++++++
|
|
|
5cef56 |
schema/VSSD.mof | 6 ++++++
|
|
|
5cef56 |
src/Virt_VSSD.c | 9 +++++++++
|
|
|
5cef56 |
src/Virt_VirtualSystemManagementService.c | 14 ++++++++++++++
|
|
|
5cef56 |
6 files changed, 49 insertions(+)
|
|
|
5cef56 |
|
|
|
5cef56 |
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
|
|
|
5cef56 |
index ad0f19c..7af3953 100644
|
|
|
5cef56 |
--- a/libxkutil/device_parsing.c
|
|
|
5cef56 |
+++ b/libxkutil/device_parsing.c
|
|
|
5cef56 |
@@ -1116,6 +1116,8 @@ static int parse_os(struct domain *dominfo, xmlNode *os)
|
|
|
5cef56 |
xmlNode *child;
|
|
|
5cef56 |
char **blist = NULL;
|
|
|
5cef56 |
unsigned bl_size = 0;
|
|
|
5cef56 |
+ char *arch = NULL;
|
|
|
5cef56 |
+ char *machine = NULL;
|
|
|
5cef56 |
char *kernel = NULL;
|
|
|
5cef56 |
char *initrd = NULL;
|
|
|
5cef56 |
char *cmdline = NULL;
|
|
|
5cef56 |
@@ -1126,6 +1128,8 @@ static int parse_os(struct domain *dominfo, xmlNode *os)
|
|
|
5cef56 |
for (child = os->children; child != NULL; child = child->next) {
|
|
|
5cef56 |
if (XSTREQ(child->name, "type")) {
|
|
|
5cef56 |
STRPROP(dominfo, os_info.pv.type, child);
|
|
|
5cef56 |
+ arch = get_attr_value(child, "arch");
|
|
|
5cef56 |
+ machine = get_attr_value(child, "machine");
|
|
|
5cef56 |
} else if (XSTREQ(child->name, "kernel"))
|
|
|
5cef56 |
kernel = get_node_content(child);
|
|
|
5cef56 |
else if (XSTREQ(child->name, "initrd"))
|
|
|
5cef56 |
@@ -1173,9 +1177,13 @@ static int parse_os(struct domain *dominfo, xmlNode *os)
|
|
|
5cef56 |
case DOMAIN_KVM:
|
|
|
5cef56 |
case DOMAIN_QEMU:
|
|
|
5cef56 |
dominfo->os_info.fv.loader = loader;
|
|
|
5cef56 |
+ dominfo->os_info.fv.arch = arch;
|
|
|
5cef56 |
+ dominfo->os_info.fv.machine = machine;
|
|
|
5cef56 |
dominfo->os_info.fv.bootlist_ct = bl_size;
|
|
|
5cef56 |
dominfo->os_info.fv.bootlist = blist;
|
|
|
5cef56 |
loader = NULL;
|
|
|
5cef56 |
+ arch = NULL;
|
|
|
5cef56 |
+ machine = NULL;
|
|
|
5cef56 |
blist = NULL;
|
|
|
5cef56 |
bl_size = 0;
|
|
|
5cef56 |
break;
|
|
|
5cef56 |
@@ -1195,6 +1203,8 @@ static int parse_os(struct domain *dominfo, xmlNode *os)
|
|
|
5cef56 |
break;
|
|
|
5cef56 |
}
|
|
|
5cef56 |
|
|
|
5cef56 |
+ free(arch);
|
|
|
5cef56 |
+ free(machine);
|
|
|
5cef56 |
free(kernel);
|
|
|
5cef56 |
free(initrd);
|
|
|
5cef56 |
free(cmdline);
|
|
|
5cef56 |
@@ -1398,6 +1408,8 @@ void cleanup_dominfo(struct domain **dominfo)
|
|
|
5cef56 |
(dom->type == DOMAIN_KVM) || (dom->type == DOMAIN_QEMU)) {
|
|
|
5cef56 |
free(dom->os_info.fv.type);
|
|
|
5cef56 |
free(dom->os_info.fv.loader);
|
|
|
5cef56 |
+ free(dom->os_info.fv.arch);
|
|
|
5cef56 |
+ free(dom->os_info.fv.machine);
|
|
|
5cef56 |
cleanup_bootlist(dom->os_info.fv.bootlist,
|
|
|
5cef56 |
dom->os_info.fv.bootlist_ct);
|
|
|
5cef56 |
} else if (dom->type == DOMAIN_LXC) {
|
|
|
5cef56 |
diff --git a/libxkutil/device_parsing.h b/libxkutil/device_parsing.h
|
|
|
5cef56 |
index 979b792..df5080c 100644
|
|
|
5cef56 |
--- a/libxkutil/device_parsing.h
|
|
|
5cef56 |
+++ b/libxkutil/device_parsing.h
|
|
|
5cef56 |
@@ -139,6 +139,8 @@ struct pv_os_info {
|
|
|
5cef56 |
|
|
|
5cef56 |
struct fv_os_info {
|
|
|
5cef56 |
char *type; /* Should always be 'hvm' */
|
|
|
5cef56 |
+ char *arch;
|
|
|
5cef56 |
+ char *machine;
|
|
|
5cef56 |
char *loader;
|
|
|
5cef56 |
unsigned bootlist_ct;
|
|
|
5cef56 |
char **bootlist;
|
|
|
5cef56 |
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
|
|
|
5cef56 |
index 30e9a5e..2ca2341 100644
|
|
|
5cef56 |
--- a/libxkutil/xmlgen.c
|
|
|
5cef56 |
+++ b/libxkutil/xmlgen.c
|
|
|
5cef56 |
@@ -811,6 +811,12 @@ static char *_kvm_os_xml(xmlNodePtr root, struct domain *domain)
|
|
|
5cef56 |
if (tmp == NULL)
|
|
|
5cef56 |
return XML_ERROR;
|
|
|
5cef56 |
|
|
|
5cef56 |
+ if (os->arch)
|
|
|
5cef56 |
+ xmlNewProp(tmp, BAD_CAST "arch", BAD_CAST os->arch);
|
|
|
5cef56 |
+
|
|
|
5cef56 |
+ if (os->machine)
|
|
|
5cef56 |
+ xmlNewProp(tmp, BAD_CAST "machine", BAD_CAST os->machine);
|
|
|
5cef56 |
+
|
|
|
5cef56 |
ret = _fv_bootlist_xml(root, os);
|
|
|
5cef56 |
if (ret == 0)
|
|
|
5cef56 |
return XML_ERROR;
|
|
|
5cef56 |
diff --git a/schema/VSSD.mof b/schema/VSSD.mof
|
|
|
5cef56 |
index 0359d67..2734d8e 100644
|
|
|
5cef56 |
--- a/schema/VSSD.mof
|
|
|
5cef56 |
+++ b/schema/VSSD.mof
|
|
|
5cef56 |
@@ -48,6 +48,12 @@ class KVM_VirtualSystemSettingData : Virt_VirtualSystemSettingData
|
|
|
5cef56 |
[Description ("The emulator the guest should use during runtime.")]
|
|
|
5cef56 |
string Emulator;
|
|
|
5cef56 |
|
|
|
5cef56 |
+ [Description ("The guest's architecture.")]
|
|
|
5cef56 |
+ string Arch;
|
|
|
5cef56 |
+
|
|
|
5cef56 |
+ [Description ("The guest's machine type")]
|
|
|
5cef56 |
+ string Machine;
|
|
|
5cef56 |
+
|
|
|
5cef56 |
};
|
|
|
5cef56 |
|
|
|
5cef56 |
[Description (
|
|
|
5cef56 |
diff --git a/src/Virt_VSSD.c b/src/Virt_VSSD.c
|
|
|
5cef56 |
index 3363b38..67e56aa 100644
|
|
|
5cef56 |
--- a/src/Virt_VSSD.c
|
|
|
5cef56 |
+++ b/src/Virt_VSSD.c
|
|
|
5cef56 |
@@ -121,6 +121,15 @@ static CMPIStatus _set_fv_prop(const CMPIBroker *broker,
|
|
|
5cef56 |
goto out;
|
|
|
5cef56 |
}
|
|
|
5cef56 |
|
|
|
5cef56 |
+ if (dominfo->os_info.fv.arch != NULL)
|
|
|
5cef56 |
+ CMSetProperty(inst, "Arch",
|
|
|
5cef56 |
+ (CMPIValue *)dominfo->os_info.fv.arch,
|
|
|
5cef56 |
+ CMPI_chars);
|
|
|
5cef56 |
+
|
|
|
5cef56 |
+ if (dominfo->os_info.fv.machine != NULL)
|
|
|
5cef56 |
+ CMSetProperty(inst, "Machine",
|
|
|
5cef56 |
+ (CMPIValue *)dominfo->os_info.fv.machine,
|
|
|
5cef56 |
+ CMPI_chars);
|
|
|
5cef56 |
out:
|
|
|
5cef56 |
return s;
|
|
|
5cef56 |
}
|
|
|
5cef56 |
diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c
|
|
|
5cef56 |
index 8ced2d6..3df878f 100644
|
|
|
5cef56 |
--- a/src/Virt_VirtualSystemManagementService.c
|
|
|
5cef56 |
+++ b/src/Virt_VirtualSystemManagementService.c
|
|
|
5cef56 |
@@ -543,6 +543,20 @@ static int fv_vssd_to_domain(CMPIInstance *inst,
|
|
|
5cef56 |
if (!fv_set_emulator(domain, val))
|
|
|
5cef56 |
return 0;
|
|
|
5cef56 |
|
|
|
5cef56 |
+ free(domain->os_info.fv.arch);
|
|
|
5cef56 |
+ ret = cu_get_str_prop(inst, "Arch", &val;;
|
|
|
5cef56 |
+ if (ret == CMPI_RC_OK)
|
|
|
5cef56 |
+ domain->os_info.fv.arch = strdup(val);
|
|
|
5cef56 |
+ else
|
|
|
5cef56 |
+ domain->os_info.fv.arch = NULL;
|
|
|
5cef56 |
+
|
|
|
5cef56 |
+ free(domain->os_info.fv.machine);
|
|
|
5cef56 |
+ ret = cu_get_str_prop(inst, "Machine", &val;;
|
|
|
5cef56 |
+ if (ret == CMPI_RC_OK)
|
|
|
5cef56 |
+ domain->os_info.fv.machine = strdup(val);
|
|
|
5cef56 |
+ else
|
|
|
5cef56 |
+ domain->os_info.fv.machine = NULL;
|
|
|
5cef56 |
+
|
|
|
5cef56 |
return 1;
|
|
|
5cef56 |
}
|
|
|
5cef56 |
|
|
|
5cef56 |
--
|
|
|
5cef56 |
1.8.5.3
|
|
|
5cef56 |
|