[libvirt] [PATCH python] virStream.sendAll() fix raising an undeclared var
by Doug Goldstein
The exception is raised from the variable 'e', which was undeclared in
this context. Used code that is compatible with old and new Python
versions.
---
libvirt-override-virStream.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/libvirt-override-virStream.py b/libvirt-override-virStream.py
index 189d062..cd44314 100644
--- a/libvirt-override-virStream.py
+++ b/libvirt-override-virStream.py
@@ -76,6 +76,7 @@
try:
got = handler(self, 1024*64, opaque)
except:
+ e = sys.exc_info()[1]
try:
self.abort()
except:
--
1.8.3.2
10 years, 10 months
[libvirt] [PATCH] Exercise the ABI stability check code in test suite
by Daniel P. Berrange
Any test suite which involves a virDomainDefPtr should
call virDomainDefCheckABIStability with itself just as
a basic sanity check that the identity-comparison always
succeeds. This would have caught the recent NULL pointer
access crash.
Make sure we cope with def->name being NULL since the
VMWare config parser produces NULL names.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/conf/domain_conf.c | 2 +-
tests/lxcxml2xmltest.c | 5 +++++
tests/qemuargv2xmltest.c | 5 +++++
tests/qemuxml2argvtest.c | 5 +++++
tests/qemuxml2xmltest.c | 5 +++++
tests/qemuxmlnstest.c | 5 +++++
tests/sexpr2xmltest.c | 5 +++++
tests/vmx2xmltest.c | 5 +++++
tests/xmconfigtest.c | 5 +++++
tests/xml2sexprtest.c | 5 +++++
tests/xml2vmxtest.c | 5 +++++
11 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 416d96e..c1dd598 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13761,7 +13761,7 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
* don't get silently re-named through the backdoor when passing
* custom XML into various APIs, since this would create havoc
*/
- if (STRNEQ(src->name, dst->name)) {
+ if (STRNEQ_NULLABLE(src->name, dst->name)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target domain name '%s' does not match source '%s'"),
dst->name, src->name);
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index a028e39..b7d35c1 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -41,6 +41,11 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
live ? 0 : VIR_DOMAIN_XML_INACTIVE)))
goto fail;
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", inxml);
+ goto fail;
+ }
+
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
goto fail;
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 0bf4c37..1b13fcc 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -61,6 +61,11 @@ static int testCompareXMLToArgvFiles(const char *xml,
}
VIR_FREE(log);
+ if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto fail;
+ }
+
if (!(actualxml = virDomainDefFormat(vmdef, 0)))
goto fail;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b90f0e7..b0cfa60 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -289,6 +289,11 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto out;
}
+ if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto out;
+ }
+
if (virQEMUCapsGet(extraFlags, QEMU_CAPS_DOMID))
vmdef->id = 6;
else
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 89de0c9..41d1904 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -41,6 +41,11 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml, bool live)
QEMU_EXPECTED_VIRT_TYPES, flags)))
goto fail;
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", inxml);
+ goto fail;
+ }
+
if (!(actual = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE | flags)))
goto fail;
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 2093e1e..9426bf7 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -59,6 +59,11 @@ static int testCompareXMLToArgvFiles(const char *xml,
VIR_DOMAIN_XML_INACTIVE)))
goto fail;
+ if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto fail;
+ }
+
/*
* For test purposes, we may want to fake emulator's output by providing
* our own script instead of a real emulator. For this to work we need to
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index f8b0661..c2710c2 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -60,6 +60,11 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
if (!(def = xenParseSxprString(sexprData, xendConfigVersion, tty, vncport)))
goto fail;
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto fail;
+ }
+
if (!(gotxml = virDomainDefFormat(def, 0)))
goto fail;
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 13515f0..5c3b60e 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -88,6 +88,11 @@ testCompareFiles(const char *vmx, const char *xml)
if (!(def = virVMXParseConfig(&ctx, xmlopt, vmxData)))
goto cleanup;
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", vmx);
+ goto cleanup;
+ }
+
if (!(formatted = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE)))
goto cleanup;
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index c8014e1..0590333 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -77,6 +77,11 @@ testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
VIR_DOMAIN_XML_INACTIVE)))
goto fail;
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto fail;
+ }
+
if (!(conf = xenFormatXM(conn, def, xendConfigVersion)))
goto fail;
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index a4d2b14..deb2fce 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -41,6 +41,11 @@ testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
VIR_DOMAIN_XML_INACTIVE)))
goto fail;
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto fail;
+ }
+
if (!(gotsexpr = xenFormatSxpr(NULL, def, xendConfigVersion)))
goto fail;
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 2f2db60..242b854 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -97,6 +97,11 @@ testCompareFiles(const char *xml, const char *vmx, int virtualHW_version)
goto failure;
}
+ if (!virDomainDefCheckABIStability(def, def)) {
+ fprintf(stderr, "ABI stability check failed on %s", xml);
+ goto failure;
+ }
+
formatted = virVMXFormatConfig(&ctx, xmlopt, def, virtualHW_version);
if (formatted == NULL) {
--
1.8.4.2
10 years, 10 months
[libvirt] [PATCH] schema: fix idmap validation
by Eric Blake
When idmap was added to LXC, we forgot to cover it in the testsuite.
The schema was missing an <element> layer, and as a result,
virt-xml-validate was failing on valid dumpxml output.
Reported by Eduard - Gabriel Munteanu on IRC.
* docs/schemas/domaincommon.rng (idmap): Include <idmap> element,
and support interleaves.
* tests/lxcxml2xmldata/lxc-idmap.xml: New file.
* tests/lxcxml2xmltest.c (mymain): Test it.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Eduard, please confirm I spelled your name correctly.
docs/schemas/domaincommon.rng | 58 +++++++++++++++++++++-----------------
tests/lxcxml2xmldata/lxc-idmap.xml | 38 +++++++++++++++++++++++++
tests/lxcxml2xmltest.c | 1 +
3 files changed, 71 insertions(+), 26 deletions(-)
create mode 100644 tests/lxcxml2xmldata/lxc-idmap.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 86a60c9..a69f6b6 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -506,32 +506,38 @@
</interleave>
</define>
<define name="idmap">
- <zeroOrMore>
- <element name="uid">
- <attribute name="start">
- <ref name="unsignedInt"/>
- </attribute>
- <attribute name="target">
- <ref name="unsignedInt"/>
- </attribute>
- <attribute name="count">
- <ref name="unsignedInt"/>
- </attribute>
- </element>
- </zeroOrMore>
- <zeroOrMore>
- <element name="gid">
- <attribute name="start">
- <ref name="unsignedInt"/>
- </attribute>
- <attribute name="target">
- <ref name="unsignedInt"/>
- </attribute>
- <attribute name="count">
- <ref name="unsignedInt"/>
- </attribute>
- </element>
- </zeroOrMore>
+ <element name="idmap">
+ <interleave>
+ <zeroOrMore>
+ <element name="uid">
+ <attribute name="start">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="target">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="count">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <empty/>
+ </element>
+ </zeroOrMore>
+ <zeroOrMore>
+ <element name="gid">
+ <attribute name="start">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="target">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <attribute name="count">
+ <ref name="unsignedInt"/>
+ </attribute>
+ <empty/>
+ </element>
+ </zeroOrMore>
+ </interleave>
+ </element>
</define>
<!--
Resources usage defines the amount of memory (maximum and possibly
diff --git a/tests/lxcxml2xmldata/lxc-idmap.xml b/tests/lxcxml2xmldata/lxc-idmap.xml
new file mode 100644
index 0000000..3cced21
--- /dev/null
+++ b/tests/lxcxml2xmldata/lxc-idmap.xml
@@ -0,0 +1,38 @@
+<domain type='lxc'>
+ <name>jessie</name>
+ <uuid>e21987a5-e98e-9c99-0e35-803e4d9ad1fe</uuid>
+ <memory unit='KiB'>1048576</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <resource>
+ <partition>/machine</partition>
+ </resource>
+ <os>
+ <type arch='x86_64'>exe</type>
+ <init>/sbin/init</init>
+ </os>
+ <idmap>
+ <uid start='0' target='100000' count='100000'/>
+ <gid start='0' target='100000' count='100000'/>
+ </idmap>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/libexec/libvirt_lxc</emulator>
+ <filesystem type='mount' accessmode='passthrough'>
+ <source dir='/mach/jessie'/>
+ <target dir='/'/>
+ </filesystem>
+ <interface type='bridge'>
+ <mac address='00:16:3e:0f:ef:8a'/>
+ <source bridge='bri0'/>
+ <target dev='veth0'/>
+ </interface>
+ <console type='pty'>
+ <target type='lxc' port='0'/>
+ </console>
+ </devices>
+ <seclabel type='none'/>
+</domain>
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index a028e39..c6bb706 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -138,6 +138,7 @@ mymain(void)
DO_TEST("disk-formats");
DO_TEST_DIFFERENT("filesystem-ram");
DO_TEST("filesystem-root");
+ DO_TEST("idmap");
virObjectUnref(caps);
virObjectUnref(xmlopt);
--
1.8.4.2
10 years, 10 months
[libvirt] [PATCH] conf: Always use VIR_ERR_XML_ERROR on enumFromString() failures
by Christophe Fergeau
Currently, during XML parsing, when a call to a FromString() function to
get an enum value fails, the error which is reported is either
VIR_ERR_CONFIG_UNSUPPORTED, VIR_ERR_INTERNAL_ERROR or VIR_ERR_XML_ERROR.
This commit makes such conversion failures consistently return
VIR_ERR_XML_ERROR
---
src/conf/device_conf.c | 2 +-
src/conf/domain_conf.c | 158 ++++++++++++++++++++++----------------------
src/conf/network_conf.c | 2 +-
src/conf/node_device_conf.c | 4 +-
src/conf/nwfilter_conf.c | 4 +-
src/conf/snapshot_conf.c | 4 +-
6 files changed, 87 insertions(+), 87 deletions(-)
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index f49dc21..4084133 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -92,7 +92,7 @@ virDevicePCIAddressParseXML(xmlNodePtr node,
if (multi &&
((addr->multi = virDeviceAddressPciMultiTypeFromString(multi)) <= 0)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown value '%s' for <address> 'multifunction' attribute"),
multi);
goto cleanup;
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 416d96e..dd1c6fa 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3566,7 +3566,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
char *rombar = virXMLPropString(rom, "bar");
if (rombar &&
((info->rombar = virDomainPciRombarModeTypeFromString(rombar)) <= 0)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown rom bar value '%s'"), rombar);
VIR_FREE(rombar);
goto cleanup;
@@ -3582,7 +3582,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
if (type) {
if ((info->type = virDomainDeviceAddressTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown address type '%s'"), type);
goto cleanup;
}
@@ -4211,7 +4211,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
if ((backendStr = virXPathString("string(./driver/@name)", ctxt)) &&
(((backend = virDomainHostdevSubsysPciBackendTypeFromString(backendStr)) < 0) ||
backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown PCI device <driver name='%s'/> "
"has been specified"), backendStr);
goto error;
@@ -5058,7 +5058,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
type = virXMLPropString(node, "type");
if (type) {
if ((def->type = virDomainDiskTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk type '%s'"), type);
goto error;
}
@@ -5130,7 +5130,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (trans) {
def->geometry.trans = virDomainDiskGeometryTransTypeFromString(trans);
if (def->geometry.trans <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("invalid translation value '%s'"),
trans);
goto error;
@@ -5379,7 +5379,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
device = virXMLPropString(node, "device");
if (device) {
if ((def->device = virDomainDiskDeviceTypeFromString(device)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk device '%s'"), device);
goto error;
}
@@ -5454,7 +5454,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (snapshot) {
def->snapshot = virDomainSnapshotLocationTypeFromString(snapshot);
if (def->snapshot <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk snapshot setting '%s'"),
snapshot);
goto error;
@@ -5495,7 +5495,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (bus) {
if ((def->bus = virDomainDiskBusTypeFromString(bus)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk bus type '%s'"), bus);
goto error;
}
@@ -5570,14 +5570,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (cachetag &&
(def->cachemode = virDomainDiskCacheTypeFromString(cachetag)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk cache mode '%s'"), cachetag);
goto error;
}
if (error_policy &&
(def->error_policy = virDomainDiskErrorPolicyTypeFromString(error_policy)) <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk error policy '%s'"), error_policy);
goto error;
}
@@ -5586,7 +5586,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
(((def->rerror_policy
= virDomainDiskErrorPolicyTypeFromString(rerror_policy)) <= 0) ||
(def->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE))) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk read error policy '%s'"),
rerror_policy);
goto error;
@@ -5595,7 +5595,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (iotag) {
if ((def->iomode = virDomainDiskIoTypeFromString(iotag)) < 0 ||
def->iomode == VIR_DOMAIN_DISK_IO_DEFAULT) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk io mode '%s'"), iotag);
goto error;
}
@@ -5612,7 +5612,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk ioeventfd mode '%s'"),
ioeventfd);
goto error;
@@ -5630,7 +5630,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
int idx;
if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk event_idx mode '%s'"),
event_idx);
goto error;
@@ -5641,7 +5641,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (copy_on_read) {
int cor;
if ((cor = virDomainDiskCopyOnReadTypeFromString(copy_on_read)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk copy_on_read mode '%s'"),
copy_on_read);
goto error;
@@ -5651,7 +5651,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (discard) {
if ((def->discard = virDomainDiskDiscardTypeFromString(discard)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk discard mode '%s'"), discard);
goto error;
}
@@ -5676,7 +5676,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
int val;
if ((val = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown startupPolicy value '%s'"),
startupPolicy);
goto error;
@@ -5726,7 +5726,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (driverType) {
def->format = virStorageFileFormatTypeFromString(driverType);
if (def->format <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown driver format value '%s'"),
driverType);
goto error;
@@ -5736,7 +5736,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
if (mirrorFormat) {
def->mirrorFormat = virStorageFileFormatTypeFromString(mirrorFormat);
if (def->mirrorFormat <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown mirror format value '%s'"),
driverType);
goto error;
@@ -5887,7 +5887,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
type = virXMLPropString(node, "type");
if (type) {
if ((def->type = virDomainControllerTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown controller type '%s'"), type);
goto error;
}
@@ -5906,7 +5906,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
model = virXMLPropString(node, "model");
if (model) {
if ((def->model = virDomainControllerModelTypeFromString(def, model)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown model type '%s'"), model);
goto error;
}
@@ -6081,7 +6081,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
type = virXMLPropString(node, "type");
if (type) {
if ((def->type = virDomainFSTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown filesystem type '%s'"), type);
goto error;
}
@@ -6092,7 +6092,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
accessmode = virXMLPropString(node, "accessmode");
if (accessmode) {
if ((def->accessmode = virDomainFSAccessModeTypeFromString(accessmode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown accessmode '%s'"), accessmode);
goto error;
}
@@ -6148,7 +6148,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
if (fsdriver) {
if ((def->fsdriver = virDomainFSDriverTypeTypeFromString(fsdriver)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown fs driver type '%s'"), fsdriver);
goto error;
}
@@ -6156,7 +6156,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
if (format) {
if ((def->format = virStorageFileFormatTypeFromString(format)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown driver format value '%s'"), format);
goto error;
}
@@ -6164,7 +6164,7 @@ virDomainFSDefParseXML(xmlNodePtr node,
if (wrpolicy) {
if ((def->wrpolicy = virDomainFSWrpolicyTypeFromString(wrpolicy)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown filesystem write policy '%s'"), wrpolicy);
goto error;
}
@@ -6259,7 +6259,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
goto error;
}
if ((actual->type = virDomainNetTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown type '%s' in interface's <actual> element"), type);
goto error;
}
@@ -6302,7 +6302,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
if (mode) {
int m;
if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown mode '%s' in interface <actual> element"),
mode);
goto error;
@@ -6417,7 +6417,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
type = virXMLPropString(node, "type");
if (type != NULL) {
if ((int)(def->type = virDomainNetTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown interface type '%s'"), type);
goto error;
}
@@ -6684,7 +6684,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (mode != NULL) {
int m;
if ((m = virNetDevMacVLanModeTypeFromString(mode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("Unknown mode has been specified"));
goto error;
}
@@ -6758,7 +6758,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
int name;
if ((name = virDomainNetBackendTypeFromString(backend)) < 0 ||
name == VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown interface <driver name='%s'> "
"has been specified"),
backend);
@@ -6770,7 +6770,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
int m;
if ((m = virDomainNetVirtioTxModeTypeFromString(txmode)) < 0 ||
m == VIR_DOMAIN_NET_VIRTIO_TX_MODE_DEFAULT) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown interface <driver txmode='%s'> "
"has been specified"),
txmode);
@@ -6781,7 +6781,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (ioeventfd) {
int val;
if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown interface ioeventfd mode '%s'"),
ioeventfd);
goto error;
@@ -6791,7 +6791,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (event_idx) {
int idx;
if ((idx = virDomainVirtioEventIdxTypeFromString(event_idx)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown interface event_idx mode '%s'"),
event_idx);
goto error;
@@ -6813,7 +6813,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
if (linkstate != NULL) {
if ((def->linkstate = virDomainNetInterfaceLinkStateTypeFromString(linkstate)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown interface link state '%s'"),
linkstate);
goto error;
@@ -7198,7 +7198,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW;
else if ((def->data.tcp.protocol =
virDomainChrTcpProtocolTypeFromString(protocol)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown protocol '%s'"), protocol);
goto error;
}
@@ -7555,7 +7555,7 @@ virDomainTPMDefParseXML(xmlNodePtr node,
model = virXMLPropString(node, "model");
if (model != NULL &&
(int)(def->model = virDomainTPMModelTypeFromString(model)) < 0) {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown TPM frontend model '%s'"), model);
goto error;
} else {
@@ -7646,14 +7646,14 @@ virDomainInputDefParseXML(const char *ostype,
}
if ((def->type = virDomainInputTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown input device type '%s'"), type);
goto error;
}
if (bus) {
if ((def->bus = virDomainInputBusTypeFromString(bus)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown input bus type '%s'"), bus);
goto error;
}
@@ -7739,7 +7739,7 @@ virDomainHubDefParseXML(xmlNodePtr node, unsigned int flags)
}
if ((def->type = virDomainHubTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown hub device type '%s'"), type);
goto error;
}
@@ -7787,7 +7787,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
goto error;
}
if ((def->name = virDomainTimerNameTypeFromString(name)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown timer name '%s'"), name);
goto error;
}
@@ -7809,7 +7809,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
tickpolicy = virXMLPropString(node, "tickpolicy");
if (tickpolicy != NULL) {
if ((def->tickpolicy = virDomainTimerTickpolicyTypeFromString(tickpolicy)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown timer tickpolicy '%s'"), tickpolicy);
goto error;
}
@@ -7819,7 +7819,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
track = virXMLPropString(node, "track");
if (track != NULL) {
if ((def->track = virDomainTimerTrackTypeFromString(track)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown timer track '%s'"), track);
goto error;
}
@@ -7838,7 +7838,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
mode = virXMLPropString(node, "mode");
if (mode != NULL) {
if ((def->mode = virDomainTimerModeTypeFromString(mode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown timer mode '%s'"), mode);
goto error;
}
@@ -7941,7 +7941,7 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node,
if (connected) {
int action = virDomainGraphicsAuthConnectedTypeFromString(connected);
if (action <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown connected value %s"),
connected);
VIR_FREE(connected);
@@ -8060,7 +8060,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
}
if ((def->type = virDomainGraphicsTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown graphics device type '%s'"), type);
goto error;
}
@@ -8186,7 +8186,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy);
if (policy < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown vnc display sharing policy '%s'"), sharePolicy);
VIR_FREE(sharePolicy);
goto error;
@@ -8332,7 +8332,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((defaultMode = virXMLPropString(node, "defaultMode")) != NULL) {
if ((defaultModeVal = virDomainGraphicsSpiceChannelModeTypeFromString(defaultMode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown default spice channel mode %s"),
defaultMode);
VIR_FREE(defaultMode);
@@ -8376,7 +8376,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
}
if ((nameval = virDomainGraphicsSpiceChannelNameTypeFromString(name)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown spice channel name %s"),
name);
VIR_FREE(name);
@@ -8384,7 +8384,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
goto error;
}
if ((modeval = virDomainGraphicsSpiceChannelModeTypeFromString(mode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown spice channel mode %s"),
mode);
VIR_FREE(name);
@@ -8407,7 +8407,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((compressionVal =
virDomainGraphicsSpiceImageCompressionTypeFromString(compression)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown spice image compression %s"),
compression);
VIR_FREE(compression);
@@ -8428,7 +8428,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((compressionVal =
virDomainGraphicsSpiceJpegCompressionTypeFromString(compression)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown spice jpeg compression %s"),
compression);
VIR_FREE(compression);
@@ -8449,7 +8449,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((compressionVal =
virDomainGraphicsSpiceZlibCompressionTypeFromString(compression)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown spice zlib compression %s"),
compression);
VIR_FREE(compression);
@@ -8470,7 +8470,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((compressionVal =
virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("unknown spice playback compression"));
VIR_FREE(compression);
goto error;
@@ -8490,7 +8490,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
}
if ((modeVal =
virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("unknown spice streaming mode"));
VIR_FREE(mode);
goto error;
@@ -8511,7 +8511,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((copypasteVal =
virDomainGraphicsSpiceClipboardCopypasteTypeFromString(copypaste)) <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown copypaste value '%s'"), copypaste);
VIR_FREE(copypaste);
goto error;
@@ -8571,7 +8571,7 @@ virDomainSoundCodecDefParseXML(xmlNodePtr node)
type = virXMLPropString(node, "type");
if ((def->type = virDomainSoundCodecTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown codec type '%s'"), type);
goto error;
}
@@ -8604,7 +8604,7 @@ virDomainSoundDefParseXML(xmlNodePtr node,
model = virXMLPropString(node, "model");
if ((def->model = virDomainSoundModelTypeFromString(model)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown sound model '%s'"), model);
goto error;
}
@@ -8677,7 +8677,7 @@ virDomainWatchdogDefParseXML(xmlNodePtr node,
}
def->model = virDomainWatchdogModelTypeFromString(model);
if (def->model < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown watchdog model '%s'"), model);
goto error;
}
@@ -8688,7 +8688,7 @@ virDomainWatchdogDefParseXML(xmlNodePtr node,
else {
def->action = virDomainWatchdogActionTypeFromString(action);
if (def->action < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown watchdog action '%s'"), action);
goto error;
}
@@ -8923,7 +8923,7 @@ virSysinfoParseXML(xmlNodePtr node,
goto error;
}
if ((def->type = virSysinfoTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown sysinfo type '%s'"), type);
goto error;
}
@@ -9159,7 +9159,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
if (type) {
if ((def->type = virDomainVideoTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown video model '%s'"), type);
goto error;
}
@@ -9245,7 +9245,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
if (mode) {
if ((def->mode = virDomainHostdevModeTypeFromString(mode)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown hostdev mode '%s'"), mode);
goto error;
}
@@ -9333,7 +9333,7 @@ virDomainRedirdevDefParseXML(xmlNodePtr node,
bus = virXMLPropString(node, "bus");
if (bus) {
if ((def->bus = virDomainRedirdevBusTypeFromString(bus)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown redirdev bus '%s'"), bus);
goto error;
}
@@ -9344,7 +9344,7 @@ virDomainRedirdevDefParseXML(xmlNodePtr node,
type = virXMLPropString(node, "type");
if (type) {
if ((def->source.chr.type = virDomainChrTypeFromString(type)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown redirdev character device type '%s'"), type);
goto error;
}
@@ -9599,7 +9599,7 @@ virDomainEventActionParseXML(xmlXPathContextPtr ctxt,
} else {
*val = convFunc(tmp);
if (*val < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown %s action: %s"), name, tmp);
VIR_FREE(tmp);
return -1;
@@ -9619,7 +9619,7 @@ virDomainPMStateParseXML(xmlXPathContextPtr ctxt,
if (tmp) {
*val = virDomainPMStateTypeFromString(tmp);
if (*val < 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown PM state value %s"), tmp);
goto cleanup;
}
@@ -10619,7 +10619,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
goto cleanup;
}
if ((val = virDomainBootTypeFromString(dev)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown boot device '%s'"),
dev);
VIR_FREE(dev);
@@ -11023,7 +11023,7 @@ virDomainDefParseXML(xmlDocPtr xml,
}
if ((def->virtType = virDomainVirtTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("invalid domain type %s"), tmp);
goto error;
}
@@ -11579,7 +11579,7 @@ virDomainDefParseXML(xmlDocPtr xml,
for (i = 0; i < n; i++) {
int val = virDomainFeatureTypeFromString((const char *)nodes[i]->name);
if (val < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unexpected feature '%s'"), nodes[i]->name);
goto error;
}
@@ -11589,7 +11589,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if ((tmp = virXPathString("string(./features/apic/@eoi)", ctxt))) {
int eoi;
if ((eoi = virDomainFeatureStateTypeFromString(tmp)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown value for attribute eoi: '%s'"),
tmp);
goto error;
@@ -11612,7 +11612,7 @@ virDomainDefParseXML(xmlDocPtr xml,
ctxt->node = nodes[i];
if ((tmp = virXPathString("string(./@state)", ctxt))) {
if ((def->features[val] = virDomainFeatureStateTypeFromString(tmp)) == -1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown state attribute '%s' of feature '%s'"),
tmp, virDomainFeatureTypeToString(val));
goto error;
@@ -11755,7 +11755,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if ((tmp = virXPathString("string(./clock/@offset)", ctxt)) &&
(def->clock.offset = virDomainClockOffsetTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown clock offset '%s'"), tmp);
goto error;
}
@@ -11799,7 +11799,7 @@ virDomainDefParseXML(xmlDocPtr xml,
tmp = virXPathString("string(./clock/@basis)", ctxt);
if (tmp) {
if ((def->clock.data.variable.basis = virDomainClockBasisTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown clock basis '%s'"), tmp);
goto error;
}
@@ -11881,7 +11881,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (tmp) {
def->os.arch = virArchFromString(tmp);
if (!def->os.arch) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown architecture %s"),
tmp);
goto error;
@@ -12686,7 +12686,7 @@ virDomainDefParseXML(xmlDocPtr xml,
int mode;
if ((mode = virDomainSmbiosModeTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown smbios mode '%s'"), tmp);
goto error;
}
@@ -12770,7 +12770,7 @@ virDomainObjParseXML(xmlDocPtr xml,
goto error;
}
if ((state = virDomainStateTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("invalid domain state '%s'"), tmp);
VIR_FREE(tmp);
goto error;
@@ -12779,7 +12779,7 @@ virDomainObjParseXML(xmlDocPtr xml,
if ((tmp = virXPathString("string(./@reason)", ctxt))) {
if ((reason = virDomainStateReasonFromString(state, tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("invalid domain state reason '%s'"), tmp);
VIR_FREE(tmp);
goto error;
@@ -12804,7 +12804,7 @@ virDomainObjParseXML(xmlDocPtr xml,
if (str) {
int flag = virDomainTaintTypeFromString(str);
if (flag < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown taint flag %s"), str);
VIR_FREE(str);
goto error;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 481fc5b..537cc2a 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1747,7 +1747,7 @@ virNetworkForwardDefParseXML(const char *networkName,
= virNetworkForwardDriverNameTypeFromString(forwardDriverName);
if (driverName <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("Unknown forward <driver name='%s'/> "
"in network %s"),
forwardDriverName, networkName);
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 171cd7c..51a76ea 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -854,7 +854,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
int val = virNodeDevNetCapTypeFromString(tmp);
VIR_FREE(tmp);
if (val < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("invalid network type supplied for '%s'"),
def->name);
goto out;
@@ -1166,7 +1166,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
}
if ((val = virNodeDevCapTypeFromString(tmp)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown capability type '%s'"), tmp);
VIR_FREE(tmp);
goto error;
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index d280df5..3ebdc1f 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2319,7 +2319,7 @@ virNWFilterRuleParse(xmlNodePtr node)
}
if ((ret->action = virNWFilterRuleActionTypeFromString(action)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
"%s",
_("unknown rule action attribute value"));
goto err_exit;
@@ -2333,7 +2333,7 @@ virNWFilterRuleParse(xmlNodePtr node)
}
if ((ret->tt = virNWFilterRuleDirectionTypeFromString(direction)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
"%s",
_("unknown rule direction attribute value"));
goto err_exit;
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index c18b99b..74ffe47 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -121,7 +121,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
if (snapshot) {
def->snapshot = virDomainSnapshotLocationTypeFromString(snapshot);
if (def->snapshot <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk snapshot setting '%s'"),
snapshot);
goto cleanup;
@@ -157,7 +157,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
if (driver) {
def->format = virStorageFileFormatTypeFromString(driver);
if (def->format <= 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_XML_ERROR,
_("unknown disk snapshot driver '%s'"),
driver);
VIR_FREE(driver);
--
1.8.4.2
10 years, 10 months
[libvirt] [v9 0/6] Write separate module for hostdev passthrough
by Chunyan Liu
These patches implements a separate module for hostdev passthrough so that it
could be shared by different drivers and can maintain a global state of a host
device.
patch 1/6: extract hostdev passthrough function from qemu_hostdev.c and make it
reusable by multiple drivers.
patch 2/6: add a unit test for hostdev common library.
patch 3/6: switch qemu driver to use the common library instead of its own
hostdev passthrough APIs.
patch 4/6: switch lxc driver to use the common library instead of its own
hostdev passthrough APIs.
patch 5/6: add a hostdev pci backend type for xen usage.
patch 6/6: add pci passthrough to libxl driver.
---
Changes
* rebase to lasest source code
* fix ioctl return value in virHostdevHostSupportsPassthroughKVM()
Chunyan Liu (6):
add hostdev passthrough common library
add unit test for hostdev common library
change qemu driver to use hostdev common library
change lxc driver to use hostdev common library
add hostdev pci backend type for xen
add pci passthrough to libxl driver
docs/schemas/domaincommon.rng | 1 +
po/POTFILES.in | 3 +-
src/Makefile.am | 3 +-
src/conf/domain_conf.c | 3 +-
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 21 +
src/libxl/libxl_conf.c | 63 +
src/libxl/libxl_conf.h | 4 +
src/libxl/libxl_domain.c | 9 +
src/libxl/libxl_driver.c | 448 +++++-
src/lxc/lxc_conf.h | 4 -
src/lxc/lxc_driver.c | 47 +-
src/lxc/lxc_hostdev.c | 413 -----
src/lxc/lxc_hostdev.h | 43 -
src/lxc/lxc_process.c | 24 +-
src/qemu/qemu_command.c | 4 +-
src/qemu/qemu_conf.h | 9 +-
src/qemu/qemu_domain.c | 22 +
src/qemu/qemu_driver.c | 81 +-
src/qemu/qemu_hostdev.c | 1454 -----------------
src/qemu/qemu_hostdev.h | 76 -
src/qemu/qemu_hotplug.c | 136 +-
src/qemu/qemu_process.c | 40 +-
src/util/virhostdev.c | 1703 ++++++++++++++++++++
src/util/virhostdev.h | 134 ++
src/util/virpci.c | 30 +-
src/util/virpci.h | 9 +-
src/util/virscsi.c | 28 +-
src/util/virscsi.h | 8 +-
src/util/virusb.c | 29 +-
src/util/virusb.h | 8 +-
tests/Makefile.am | 5 +
.../qemuxml2argv-hostdev-pci-address.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 2 +
tests/virhostdevtest.c | 481 ++++++
tests/virpcimock.c | 23 +-
37 files changed, 3159 insertions(+), 2212 deletions(-)
delete mode 100644 src/lxc/lxc_hostdev.c
delete mode 100644 src/lxc/lxc_hostdev.h
delete mode 100644 src/qemu/qemu_hostdev.c
delete mode 100644 src/qemu/qemu_hostdev.h
create mode 100644 src/util/virhostdev.c
create mode 100644 src/util/virhostdev.h
create mode 100644 tests/virhostdevtest.c
10 years, 10 months
[libvirt] processor info gotten from 'virsh sysinfo' does match proc-cpuinfo
by yue
hi,all
my environment is fc19, libvirt-1.0.5.8-1.fc19.x86_64
when systemctl start libvirtd.service , some warnning printed:
Jan 09 17:53:01 localhost.localdomain libvirtd[12516]: libvirt version: 1.0.5.8, package: 1.fc19 (Fedora Project, 2013-12-14-21:10:58, buildv...ct.org)
Jan 09 17:53:01 localhost.localdomain libvirtd[12516]: open("/var/run/libvirt/network/nwfilter.ltmp"): No such file or directory
Jan 09 17:53:02 localhost.localdomain libvirtd[12516]: internal error Cannot find suitable CPU model for given data
Jan 09 17:53:02 localhost.localdomain libvirtd[12516]: Failed to get host CPU
--virsh sysinfo---
<processor>
<entry name='socket_destination'>CPU 1</entry>
<entry name='type'>Central Processor</entry>
<entry name='family'>Other</entry>
<entry name='manufacturer'>Bochs</entry>
<entry name='version'>Not Specified</entry>
<entry name='external_clock'>Unknown</entry>
<entry name='max_speed'>2000 MHz</entry>
<entry name='status'>Populated, Enabled</entry>
</processor>
----proc/cpuinfo----------
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Westmere E56xx/L56xx/X56xx (Nehalem-C)
stepping : 1
microcode : 0x1
cpu MHz : 1861.999
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx lm constant_tsc nopl pni ssse3 cx16 sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm
bogomips : 3723.99
clflush size : 64
cache_alignment : 64
address sizes : 44 bits physical, 48 bits virtual
power management:
10 years, 10 months
[libvirt] Compile time error in event-test.c
by Avanti Ajay
Hi...
I am trying to compile the event-test.c code of the libvirt package. I am
getting this error :
I know it is a loader problem. Do I need to install any binaries?
administrator@administrator-desktop:~/Desktop/libvirt/examples/domain-events/events-c$
gcc event-test.c -o event -lvirt
/tmp/ccHd7ZUD.o: In function `main':
event-test.c:(.text+0xac9): undefined reference to
`virConnectRegisterCloseCallback'
collect2: ld returned 1 exit status
Thanks
Avanti
10 years, 10 months
[libvirt] [PATCH] test driver: Add authentication to test driver.
by Richard W.M. Jones
There is no easy way to test authentication against libvirt. This
commit modifies the test driver to allow simple username/password
authentication.
You modify the test XML by adding:
<node>
...
<auth>
<user password="123456">rich</user>
<user>jane</user>
</auth>
</node>
If there are any /node/auth/user elements, then authentication is
required by the test driver (if none are present, then the test driver
will work as before and not require authentication).
In the example above, two phony users are added:
rich password: 123456
jane no password required
The test driver will demand a username. If the password attribute is
present (or if the username entered is wrong), then the password is
also asked for and checked:
$ virsh -c test://$(pwd)/testnode.xml list
Enter username for localhost: rich
Enter rich's password for localhost: ***
Id Name State
----------------------------------------------------
1 fv0 running
2 fc4 running
Signed-off-by: Richard W.M. Jones <rjones(a)redhat.com>
---
src/test/test_driver.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 109 insertions(+), 1 deletion(-)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index cde82a1..ecad351 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -58,6 +58,7 @@
#include "virrandom.h"
#include "virstring.h"
#include "cpu/cpu.h"
+#include "virauth.h"
#define VIR_FROM_THIS VIR_FROM_TEST
@@ -82,6 +83,13 @@ typedef struct _testCell *testCellPtr;
#define MAX_CELLS 128
+struct _testAuth {
+ char *username;
+ char *password;
+};
+typedef struct _testAuth testAuth;
+typedef struct _testAuth *testAuthPtr;
+
struct _testConn {
virMutex lock;
@@ -99,6 +107,8 @@ struct _testConn {
virNodeDeviceObjList devs;
int numCells;
testCell cells[MAX_CELLS];
+ int numAuths;
+ testAuthPtr auths;
virObjectEventStatePtr eventState;
};
@@ -1355,6 +1365,44 @@ error:
return ret;
}
+static int
+testParseAuthUsers(testConnPtr privconn,
+ xmlXPathContextPtr ctxt)
+{
+ int num, ret = -1;
+ size_t i;
+ xmlNodePtr *nodes = NULL;
+
+ num = virXPathNodeSet("/node/auth/user", ctxt, &nodes);
+ if (num < 0)
+ goto error;
+
+ privconn->numAuths = num;
+ if (num && VIR_ALLOC_N(privconn->auths, num) < 0)
+ goto error;
+
+ for (i = 0; i < num; i++) {
+ char *username, *password;
+
+ ctxt->node = nodes[i];
+ username = virXPathString("string(.)", ctxt);
+ if (!username || STREQ(username, "")) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing username in /node/auth/user field"));
+ goto error;
+ }
+ /* This field is optional. */
+ password = virXMLPropString(nodes[i], "password");
+
+ privconn->auths[i].username = username;
+ privconn->auths[i].password = password;
+ }
+
+ ret = 0;
+error:
+ VIR_FREE(nodes);
+ return ret;
+}
/* No shared state between simultaneous test connections initialized
* from a file. */
@@ -1417,6 +1465,8 @@ testOpenFromFile(virConnectPtr conn, const char *file)
goto error;
if (testParseNodedevs(privconn, file, ctxt) < 0)
goto error;
+ if (testParseAuthUsers(privconn, ctxt) < 0)
+ goto error;
xmlXPathFreeContext(ctxt);
xmlFreeDoc(doc);
@@ -1439,9 +1489,63 @@ testOpenFromFile(virConnectPtr conn, const char *file)
return VIR_DRV_OPEN_ERROR;
}
+static int
+testConnectAuthenticate(virConnectPtr conn,
+ virConnectAuthPtr auth)
+{
+ testConnPtr privconn = conn->privateData;
+ int ret = -1;
+ int i;
+ char *username = NULL, *password = NULL;
+
+ if (privconn->numAuths == 0)
+ return 0;
+
+ /* Authentication is required because the test XML contains a
+ * non-empty <auth/> section. First we must ask for a username.
+ */
+ username = virAuthGetUsername(conn, auth, "test", NULL, "localhost"/*?*/);
+ if (!username) {
+ virReportError(VIR_ERR_AUTH_FAILED, "%s",
+ _("authentication failed when asking for username"));
+ goto cleanup;
+ }
+
+ /* Does the username exist? */
+ for (i = 0; i < privconn->numAuths; ++i) {
+ if (STREQ(privconn->auths[i].username, username))
+ goto found_user;
+ }
+ i = -1;
+
+found_user:
+ /* Even if we didn't find the user, we still ask for a password. */
+ if (i == -1 || privconn->auths[i].password != NULL) {
+ password = virAuthGetPassword(conn, auth, "test",
+ username, "localhost");
+ if (password == NULL) {
+ virReportError(VIR_ERR_AUTH_FAILED, "%s",
+ _("authentication failed when asking for password"));
+ goto cleanup;
+ }
+ }
+
+ if (i == -1 ||
+ (password && STRNEQ(privconn->auths[i].password, password))) {
+ virReportError(VIR_ERR_AUTH_FAILED, "%s",
+ _("authentication failed, see test XML for the correct username/password"));
+ goto cleanup;
+ }
+
+ ret = 0;
+cleanup:
+ VIR_FREE(username);
+ VIR_FREE(password);
+ return ret;
+}
static virDrvOpenStatus testConnectOpen(virConnectPtr conn,
- virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+ virConnectAuthPtr auth,
unsigned int flags)
{
int ret;
@@ -1479,6 +1583,10 @@ static virDrvOpenStatus testConnectOpen(virConnectPtr conn,
if (ret != VIR_DRV_OPEN_SUCCESS)
return ret;
+ /* Fake authentication. */
+ if (testConnectAuthenticate(conn, auth) < 0)
+ return VIR_DRV_OPEN_ERROR;
+
return VIR_DRV_OPEN_SUCCESS;
}
--
1.8.4.2
10 years, 10 months
[libvirt] Regression testing libvirt authentication
by Richard W.M. Jones
I'm trying to find a way to regression-test a program which uses
libvirt authentication (virConnectAuth, virConnectAuthPtr). Ideally
the test:/// driver would be able to fake authentication demands, but
it doesn't seem to be able to do that.
Any suggestions? Would this feature belong in the test driver or
elsewhere?
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
10 years, 10 months
[libvirt] New feature discussion: Grouping multiple libvirt's in a "pool"
by Ahmed Ossama
Greetings All,
I would like to say "Hi" to everyone on the list since this is my first
message.
I have couple of servers running CentOS and Debian with kvm and libvirt
on top. Lately I've been thinking of coordinating them together in a
pool like XenServer groups servers in a "Pool".
I am totally aware that this feature can be achieved by installing
OpenStack or any similar orchestrator on top of libvirt. But I would
like to achieve this feature using libvirt alone as I don't want to
install any stuff above libvirt.
I was also thinking if each libvirt on every server is aware of other
resources (Domains, Storage and Network), this could provide better
support and view to any higher orchestrator utilizing libvirt.
So I am wondering if such feature was discussed previously? And would
like to hear thoughts or concerns about it.
--
Regards,
Ahmed Ossama
10 years, 10 months