Flags for CPU / system 'features'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the XenD config there are various flags which allow CPU / system features
to be enabled / disabled for the guest domain. For example, HVM domains can
be created with, or without,  PAE, ACPI, APIC. The XenD sexpr contains simple
boolean flags for these features within the (image (hvm ....)) block. IMHO,
although these 3 particular features may be only be relevant for HVM, it does
not make sense to restrict the expression of features to only HVM domains.

Thus I propose a top level '<features>' block within the '<domain>' XML doc.
This block would contain tags named after each feature to be enabled. Presence
of the named tag enables the feature, ommision disables it (thus all features
are disabled by default - matching current behaviour).

As an example, to enable ACPI, PAE & APIC:

<domain type='xen' id='55'>
  <name>too</name>
  <uuid>b5d70dd275cdaca517769660b059d8bc</uuid>
  <os>
    <type>hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <boot dev='hd'/>
  </os>
  <memory>409600</memory>
  <vcpu>1</vcpu>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <devices>
   ...snipped from example..
  </devices>
</domain>

More flags could trivially be added over time. The attached patch implements
this proposal.

My only thought, is 'features' a good name for this ? Only other name I
came up with was 'capabilities' but this is harder to spell :-)

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
? COPYING
? build.log
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.53
diff -c -r1.53 xend_internal.c
*** src/xend_internal.c	11 Aug 2006 14:40:04 -0000	1.53
--- src/xend_internal.c	14 Aug 2006 14:51:39 -0000
***************
*** 1547,1552 ****
--- 1547,1563 ----
      if (tmp != NULL)
  	virBufferVSprintf(&buf, "  <on_crash>%s</on_crash>\n", tmp);
  
+     if (hvm) {
+         virBufferAdd(&buf, "  <features>\n", 13);
+         if (sexpr_int(root, "domain/image/hvm/acpi"))
+             virBufferAdd(&buf, "    <acpi/>\n", 12);
+         if (sexpr_int(root, "domain/image/hvm/apic"))
+             virBufferAdd(&buf, "    <apic/>\n", 12);
+         if (sexpr_int(root, "domain/image/hvm/pae"))
+             virBufferAdd(&buf, "    <pae/>\n", 11);
+         virBufferAdd(&buf, "  </features>\n", 14);
+     }
+        
      virBufferAdd(&buf, "  <devices>\n", 12);
  
      /* in case of HVM we have devices emulation */
Index: src/xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.32
diff -c -r1.32 xml.c
*** src/xml.c	11 Aug 2006 14:40:04 -0000	1.32
--- src/xml.c	14 Aug 2006 14:51:39 -0000
***************
*** 567,573 ****
      return (ret);
  }
  
! #endif
  
  #ifndef PROXY
  /**
--- 567,573 ----
      return (ret);
  }
  
! #endif /* 0 - UNUSED */
  
  #ifndef PROXY
  /**
***************
*** 695,700 ****
--- 695,722 ----
           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);

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]