Add support for adding the bootable S-Expr to disks. This is needd for
Xen-PV domains using GyPgrub as the boot loader.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
src/xen/xend_internal.c | 4 ++--
src/xenxs/xen_sxpr.c | 13 +++++++++++--
src/xenxs/xen_sxpr.h | 2 +-
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index fa39e8b..724e1db 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -2690,7 +2690,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
if (xenFormatSxprDisk(dev->data.disk,
&buf,
STREQ(def->os.type, "hvm") ? 1 : 0,
- priv->xendConfigVersion, 1) < 0)
+ priv->xendConfigVersion, 1, -1) < 0)
goto cleanup;
if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
@@ -2858,7 +2858,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
if (xenFormatSxprDisk(dev->data.disk,
&buf,
STREQ(def->os.type, "hvm") ? 1 : 0,
- priv->xendConfigVersion, 1) < 0)
+ priv->xendConfigVersion, 1, -1) < 0)
goto cleanup;
break;
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index d44b0dc..b78e316 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -1629,6 +1629,8 @@ xenFormatSxprChr(virDomainChrDefPtr def,
* @node: node containing disk description
* @buf: a buffer for the result S-Expr
* @xendConfigVersion: xend configuration file format
+ * @isAttach: generate format for online device update
+ * @isBootable: >0 set, 0 remove, -1 don't touch bootable flag
*
* Parse the one disk in the XML description and add it to the S-Expr in buf
* This is a temporary interface as the S-Expr interface
@@ -1642,7 +1644,8 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
virBufferPtr buf,
int hvm,
int xendConfigVersion,
- int isAttach)
+ int isAttach,
+ int isBootable)
{
/* Xend (all versions) put the floppy device config
* under the hvm (image (os)) block
@@ -1736,6 +1739,12 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
virBufferAddLit(buf, "(mode 'w!')");
else
virBufferAddLit(buf, "(mode 'w')");
+
+ if (isBootable > 0)
+ virBufferAddLit(buf, "(bootable 1)");
+ else if (isBootable == 0)
+ virBufferAddLit(buf, "(bootable 0)");
+
if (def->transient) {
XENXS_ERROR(VIR_ERR_CONFIG_UNSUPPORTED,
_("transient disks not supported yet"));
@@ -2308,7 +2317,7 @@ xenFormatSxpr(virConnectPtr conn,
for (i = 0 ; i < def->ndisks ; i++)
if (xenFormatSxprDisk(def->disks[i],
- &buf, hvm, xendConfigVersion, 0) < 0)
+ &buf, hvm, xendConfigVersion, 0, -1) < 0)
goto error;
for (i = 0 ; i < def->nnets ; i++)
diff --git a/src/xenxs/xen_sxpr.h b/src/xenxs/xen_sxpr.h
index a66c60a..c03c0af 100644
--- a/src/xenxs/xen_sxpr.h
+++ b/src/xenxs/xen_sxpr.h
@@ -47,7 +47,7 @@ int xenParseSxprSound(virDomainDefPtr def, const char *str);
virDomainChrDefPtr xenParseSxprChar(const char *value, const char *tty);
int xenFormatSxprDisk(virDomainDiskDefPtr def, virBufferPtr buf, int hvm,
- int xendConfigVersion, int isAttach);
+ int xendConfigVersion, int isAttach, int isBootable);
int xenFormatSxprNet(virConnectPtr conn,
virDomainNetDefPtr def, virBufferPtr buf, int hvm,
--
1.7.1