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

Re: [libvirt] [PATCH v2 2/5] conf: add XML schema for domain XML

On 2011年12月22日 15:04, Taku Izumi wrote:

This patch introduces XML schema for domains to retain arbitrary capabilities.
For example, by adding the following XML to domain configuration,
its domain can retain cap_sys_rawio capability.

     <cap name='sys_rawio'/>

Signed-off-by: Taku Izumi<izumi taku jp fujitsu com>
Signed-off-by: Shota Hirae<m11g1401 hibikino ne jp>
  docs/formatdomain.html.in     |   48 ++++++++++++++++++++++++++++++++++++++
  docs/schemas/domaincommon.rng |   52 ++++++++++++++++++++++++++++++++++++++++++
  src/conf/domain_conf.c        |   33 ++++++++++++++++++++++++++
  src/conf/domain_conf.h        |    2 +
  4 files changed, 135 insertions(+)

Index: libvirt/docs/schemas/domaincommon.rng
--- libvirt.orig/docs/schemas/domaincommon.rng
+++ libvirt/docs/schemas/domaincommon.rng
@@ -35,6 +35,9 @@
          <ref name="clock"/>
          <ref name="resources"/>
          <ref name="features"/>
+<ref name="process"/>
          <ref name="termination"/>
            <ref name="devices"/>
@@ -2344,6 +2347,55 @@
+      Specification of process element
+    -->
+<define name="process">
+<element name="process">
+<element name="cap">
+<attribute name="name">
        CPU specification
    <define name="cpu">
Index: libvirt/src/conf/domain_conf.c
--- libvirt.orig/src/conf/domain_conf.c
+++ libvirt/src/conf/domain_conf.c
@@ -7253,6 +7253,23 @@ static virDomainDefPtr virDomainDefParse

+    n = virXPathNodeSet("./process/cap", ctxt,&nodes);
+    if (n<  0)
+        goto error;
+    if (n) {
+        for (i = 0; i<  n; i++) {
+            int val = virCapsProcessCapsTypeFromString(virXMLPropString(nodes[i], "name"));
+            if (val<  0) {
+                virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+                                     _("unexpected process cap %s"),
+                                     virXMLPropString(nodes[i], "name"));
+                goto error;
+            }
+            def->capabilities |= (1ULL<<  val);

I don't see any checking on the caps with the capabilities exposed
in the host & driver capabilities XML (virsh capabilities) in the
whole patchset, and IMHO here is the right place to do the checking.
(perhaps some helper function).

As we don't want to pass the the caps actually unsupported by OS
simply to the guest process. And get the error there.

If we don't that, that means the exposed host process caps is just


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