[PATCH 10/10] conf: Add VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING

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

 



This requires drivers to opt in to handle the raw modelstr
network model, all others will error if a passed in XML value
is not in the model enum.

Enable this feature for libxl/xen/xm and qemu drivers

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 src/conf/domain_conf.c        | 9 +++++++++
 src/conf/domain_conf.h        | 1 +
 src/libxl/libxl_domain.c      | 1 +
 src/qemu/qemu_domain.c        | 3 ++-
 src/security/virt-aa-helper.c | 3 ++-
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e951e8153b..19564c3e4f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4972,6 +4972,15 @@ virDomainDeviceDefPostParseCheckFeatures(virDomainDeviceDefPtr dev,
         virDomainDeviceDefCheckUnsupportedMemoryDevice(dev) < 0)
         return -1;
 
+    if (UNSUPPORTED(VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING) &&
+        dev->type == VIR_DOMAIN_DEVICE_NET &&
+        dev->data.net->modelstr) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("driver does not support net model '%s'"),
+                       dev->data.net->modelstr);
+        return -1;
+    }
+
     return 0;
 }
 #undef UNSUPPORTED
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b4e70480ac..b25d539cb2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2739,6 +2739,7 @@ typedef enum {
     VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS = (1 << 4),
     VIR_DOMAIN_DEF_FEATURE_USER_ALIAS = (1 << 5),
     VIR_DOMAIN_DEF_FEATURE_NO_BOOT_ORDER = (1 << 6),
+    VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING = (1 << 7),
 } virDomainDefFeatures;
 
 
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 3ada51f517..f4093411e3 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -424,6 +424,7 @@ virDomainDefParserConfig libxlDomainDefParserConfig = {
     .macPrefix = { 0x00, 0x16, 0x3e },
     .devicesPostParseCallback = libxlDomainDeviceDefPostParse,
     .domainPostParseCallback = libxlDomainDefPostParse,
+    .features = VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
 };
 
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 44d43a85c9..e1b0b08dcc 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6804,7 +6804,8 @@ virDomainDefParserConfig virQEMUDriverDomainDefParserConfig = {
     .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
                 VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
                 VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
-                VIR_DOMAIN_DEF_FEATURE_USER_ALIAS,
+                VIR_DOMAIN_DEF_FEATURE_USER_ALIAS |
+                VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
 };
 
 
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 3bd30bb417..86abd35de6 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -646,7 +646,8 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
 virDomainDefParserConfig virAAHelperDomainDefParserConfig = {
     .features = VIR_DOMAIN_DEF_FEATURE_MEMORY_HOTPLUG |
                 VIR_DOMAIN_DEF_FEATURE_OFFLINE_VCPUPIN |
-                VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS,
+                VIR_DOMAIN_DEF_FEATURE_INDIVIDUAL_VCPUS |
+                VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
 };
 
 static int
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]

  Powered by Linux