From 075337182c1dcaca2621cf95d8783ec4378052a4 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 15 Aug 2006 17:01:42 +0000 Subject: [PATCH] Added tag to XML for enable CPU/system features like PAE, ACPI --- ChangeLog | 8 ++++++++ docs/format.html | 15 +++++++++++++-- docs/libvir.html | 13 +++++++++++++ src/xend_internal.c | 11 +++++++++++ src/xml.c | 24 +++++++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4482714db4..7ee70d7f6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Aug 15 11:55:15 EDT 2006 Daniel Berrange + + * src/xml.c, src/xend_internal.c: Added a block + to XML allowing enablement of guest CPU / system features. + Currently support PAE, ACPI, APIC for HVM domains. + * docs/libvir.html: Documented new block and those + features enabled for HVM guests + Mon Aug 14 10:55:02 EDT 2006 Daniel Berrange * docs/libvir.html, docs/format.html: Updated description of diff --git a/docs/format.html b/docs/format.html index af71e9a21b..64a6f2da6f 100644 --- a/docs/format.html +++ b/docs/format.html @@ -99,13 +99,18 @@ systems:

<domain type='xen' id='3'>
   <os>
     <type>hvm</type>
     <loader>/usr/lib/xen/boot/hvmloader</loader>
-    <boot dev='da'/>
+    <boot dev='hd'/>
   </os>
   <memory>524288</memory>
   <vcpu>1</vcpu>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>restart</on_crash>
+  <features>
+     <pae/>
+     <acpi/>
+     <apic/>
+  </features>
   <devices>
     <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
     <interface type='bridge'>
@@ -128,7 +133,13 @@ systems:

<domain type='xen' id='3'>
     </disk>
     <graphics type='vnc' port='5904'/>
   </devices>
-</domain>

There is a few things to notice specifically for HVM domains:

  • the <os> block description is very different, first it indicates +</domain>

There is a few things to notice specifically for HVM domains:

  • the optional <features> block is used to enable certain + guest CPU / system features. For HVM guests the following features are defined: +
    • pae - enable PAE memory addressing
    • +
    • apic - enable IO APIC
    • +
    • acpi - enable ACPI bios
    • +
  • +
  • the <os> block description is very different, first it indicates that the type is 'hvm' for hardware virtualization, then instead of a kernel, boot and command line arguments, it points to an os boot loader which will extract the boot informations from the boot device specified diff --git a/docs/libvir.html b/docs/libvir.html index 4ad76554f6..d7bedafd2d 100644 --- a/docs/libvir.html +++ b/docs/libvir.html @@ -430,6 +430,11 @@ systems:

    <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> + <features> + <pae/> + <acpi/> + <apic/> + </features> <devices> <emulator>/usr/lib/xen/bin/qemu-dm</emulator> <interface type='bridge'> @@ -456,6 +461,14 @@ systems:

    There is a few things to notice specifically for HVM domains:

      +
    • the optional <features> block is used to enable certain + guest CPU / system features. For HVM guests the following features are defined: +
        +
      • pae - enable PAE memory addressing
      • +
      • apic - enable IO APIC
      • +
      • acpi - enable ACPI bios
      • +
      +
    • the <os> block description is very different, first it indicates that the type is 'hvm' for hardware virtualization, then instead of a kernel, boot and command line arguments, it points to an os boot loader diff --git a/src/xend_internal.c b/src/xend_internal.c index 810162a01c..f0fbc568b0 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -1547,6 +1547,17 @@ xend_parse_sexp_desc(virConnectPtr conn, struct sexpr *root) if (tmp != NULL) virBufferVSprintf(&buf, " %s\n", tmp); + if (hvm) { + virBufferAdd(&buf, " \n", 13); + if (sexpr_int(root, "domain/image/hvm/acpi")) + virBufferAdd(&buf, " \n", 12); + if (sexpr_int(root, "domain/image/hvm/apic")) + virBufferAdd(&buf, " \n", 12); + if (sexpr_int(root, "domain/image/hvm/pae")) + virBufferAdd(&buf, " \n", 11); + virBufferAdd(&buf, " \n", 14); + } + virBufferAdd(&buf, " \n", 12); /* in case of HVM we have devices emulation */ diff --git a/src/xml.c b/src/xml.c index 255a642417..8bae273009 100644 --- a/src/xml.c +++ b/src/xml.c @@ -567,7 +567,7 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags) return (ret); } -#endif +#endif /* 0 - UNUSED */ #ifndef PROXY /** @@ -695,6 +695,28 @@ virDomainParseXMLOSDescHVM(xmlNodePtr node, virBufferPtr buf, xmlXPathContextPtr xmlXPathFreeObject(obj); obj = NULL; } + + obj = xmlXPathEval(BAD_CAST "/domain/features/acpi", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) { + virBufferAdd(buf, "(acpi 1)", 8); + xmlXPathFreeObject(obj); + obj = NULL; + } + obj = xmlXPathEval(BAD_CAST "/domain/features/apic", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) { + virBufferAdd(buf, "(apic 1)", 8); + xmlXPathFreeObject(obj); + obj = NULL; + } + obj = xmlXPathEval(BAD_CAST "/domain/features/pae", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr == 1)) { + virBufferAdd(buf, "(pae 1)", 7); + xmlXPathFreeObject(obj); + obj = NULL; + } } obj = xmlXPathEval(BAD_CAST "count(domain/devices/console) > 0", ctxt);