Not all device types were represented in virDomainDeviceType, so some
types of devices couldn't be represented in a virDomainDeviceDef
(which requires a different type of pointer in the union for each
different kind of device).
Since serial, parallel, channel, and console devices are all
virDomainChrDef, and the virDomainDeviceType is never used to produce
a string from the type (and only used in the other direction
internally to code, never to produce XML), I only added one "CHR"
type, which is associated with "virDomainChrDefPtr chr" in the union.
---
New patch in V2.
src/conf/domain_conf.c | 6 +++++-
src/conf/domain_conf.h | 11 +++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..26190f1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -123,6 +123,7 @@ VIR_ENUM_IMPL(virDomainLifecycleCrash,
VIR_DOMAIN_LIFECYCLE_CRASH_LAST,
"coredump-restart")
VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
+ "none",
"disk",
"lease",
"filesystem",
@@ -135,7 +136,10 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"controller",
"graphics",
"hub",
- "redirdev")
+ "redirdev",
+ "smartcard",
+ "chr",
+ "memballoon")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 596be4d..9acf1e1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1179,7 +1179,8 @@ enum virDomainSmbiosMode {
};
/* Flags for the 'type' field in next struct */
-enum virDomainDeviceType {
+typedef enum {
+ VIR_DOMAIN_DEVICE_NONE = 0,
VIR_DOMAIN_DEVICE_DISK,
VIR_DOMAIN_DEVICE_LEASE,
VIR_DOMAIN_DEVICE_FS,
@@ -1193,9 +1194,12 @@ enum virDomainDeviceType {
VIR_DOMAIN_DEVICE_GRAPHICS,
VIR_DOMAIN_DEVICE_HUB,
VIR_DOMAIN_DEVICE_REDIRDEV,
+ VIR_DOMAIN_DEVICE_SMARTCARD,
+ VIR_DOMAIN_DEVICE_CHR,
+ VIR_DOMAIN_DEVICE_MEMBALLOON,
VIR_DOMAIN_DEVICE_LAST,
-};
+} virDomainDeviceType;
typedef struct _virDomainDeviceDef virDomainDeviceDef;
typedef virDomainDeviceDef *virDomainDeviceDefPtr;
@@ -1215,6 +1219,9 @@ struct _virDomainDeviceDef {
virDomainGraphicsDefPtr graphics;
virDomainHubDefPtr hub;
virDomainRedirdevDefPtr redirdev;
+ virDomainSmartcardDefPtr smartcard;
+ virDomainChrDefPtr chr;
+ virDomainMemballoonDefPtr memballoon;
} data;
};
--
1.7.7.6