Signed-off-by: Prerna Saxena <saxenap.ltc(a)gmail.com>
---
src/xenapi/xenapi_driver.c | 4 +++-
src/xenconfig/xen_sxpr.c | 19 +++++++++++--------
src/xenconfig/xen_xm.c | 9 ++++++---
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 42b305d..4070660 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1444,10 +1444,12 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
char *value = NULL;
defPtr->os.type = VIR_DOMAIN_OSTYPE_XEN;
if (VIR_ALLOC(defPtr->os.loader) < 0 ||
- VIR_STRDUP(defPtr->os.loader->path, "pygrub") < 0) {
+ VIR_ALLOC(defPtr->os.loader->src) < 0 ||
+ VIR_STRDUP(defPtr->os.loader->src->path, "pygrub") < 0)
{
VIR_FREE(boot_policy);
goto error;
}
+ defPtr->os.loader->src->type = VIR_STORAGE_TYPE_FILE;
xen_vm_get_pv_kernel(session, &value, vm);
if (STRNEQ(value, "")) {
if (VIR_STRDUP(defPtr->os.kernel, value) < 0) {
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index e868c05..fd3165c 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -87,15 +87,17 @@ xenParseSxprOS(const struct sexpr *node,
int hvm)
{
if (hvm) {
- if (VIR_ALLOC(def->os.loader) < 0)
+ if ((VIR_ALLOC(def->os.loader) < 0) ||
+ (VIR_ALLOC(def->os.loader->src) < 0))
goto error;
- if (sexpr_node_copy(node, "domain/image/hvm/loader",
&def->os.loader->path) < 0)
+ def->os.loader->src->type = VIR_STORAGE_TYPE_FILE;
+ if (sexpr_node_copy(node, "domain/image/hvm/loader",
&def->os.loader->src->path) < 0)
goto error;
- if (def->os.loader->path == NULL) {
- if (sexpr_node_copy(node, "domain/image/hvm/kernel",
&def->os.loader->path) < 0)
+ if (def->os.loader->src->path == NULL) {
+ if (sexpr_node_copy(node, "domain/image/hvm/kernel",
&def->os.loader->src->path) < 0)
goto error;
- if (def->os.loader->path == NULL) {
+ if (def->os.loader->src->path == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete,
missing HVM loader"));
return -1;
@@ -124,7 +126,8 @@ xenParseSxprOS(const struct sexpr *node,
/* If HVM kenrel == loader, then old xend, so kill off kernel */
if (hvm &&
def->os.kernel &&
- STREQ(def->os.kernel, def->os.loader->path)) {
+ def->os.loader->src &&
+ STREQ(def->os.kernel, def->os.loader->src->path)) {
VIR_FREE(def->os.kernel);
}
/* Drop kernel argument that has no value */
@@ -2259,9 +2262,9 @@ xenFormatSxpr(virConnectPtr conn, virDomainDefPtr def)
if (hvm) {
char bootorder[VIR_DOMAIN_BOOT_LAST+1];
if (def->os.kernel)
- virBufferEscapeSexpr(&buf, "(loader '%s')",
def->os.loader->path);
+ virBufferEscapeSexpr(&buf, "(loader '%s')",
def->os.loader->src->path);
else
- virBufferEscapeSexpr(&buf, "(kernel '%s')",
def->os.loader->path);
+ virBufferEscapeSexpr(&buf, "(kernel '%s')",
def->os.loader->src->path);
virBufferAsprintf(&buf, "(vcpus %u)",
virDomainDefGetVcpusMax(def));
if (virDomainDefHasVcpusOffline(def))
diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
index 8ef68bb..c6a1f03 100644
--- a/src/xenconfig/xen_xm.c
+++ b/src/xenconfig/xen_xm.c
@@ -47,8 +47,10 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
const char *boot;
if (VIR_ALLOC(def->os.loader) < 0 ||
- xenConfigCopyString(conf, "kernel",
&def->os.loader->path) < 0)
+ VIR_ALLOC(def->os.loader->src) < 0 ||
+ xenConfigCopyString(conf, "kernel",
&def->os.loader->src->path) < 0)
return -1;
+ def->os.loader->src->type = VIR_STORAGE_TYPE_FILE;
if (xenConfigGetString(conf, "boot", &boot, "c") < 0)
return -1;
@@ -481,9 +483,10 @@ xenFormatXMOS(virConfPtr conf, virDomainDefPtr def)
if (xenConfigSetString(conf, "builder", "hvm") < 0)
return -1;
- if (def->os.loader && def->os.loader->path &&
- xenConfigSetString(conf, "kernel", def->os.loader->path) <
0)
+ if (def->os.loader && def->os.loader->src &&
+ xenConfigSetString(conf, "kernel",
def->os.loader->src->path) < 0)
return -1;
+ def->os.loader->src->type = VIR_STORAGE_TYPE_FILE;
for (i = 0; i < def->os.nBootDevs; i++) {
switch (def->os.bootDevs[i]) {
--
1.8.1.2