[libvirt] [PATCH] conf: Split out parsing of network disk source XML elements
by Peter Krempa
virDomainDiskSourceParse got to the point of being an ugly spaghetti
mess by adding more and more stuff into it. Split out parsing of network
disk information into a separate function so that it stays contained.
---
I've had this patch on a branch that makes virDomainDiskSourceParse
uglier, but with the recent VxHS patches I've got a merge conflict, thus
I'm sending it now.
Note: this patch was generated with the "patience" diff algorithm
src/conf/domain_conf.c | 183 ++++++++++++++++++++++++++-----------------------
1 file changed, 99 insertions(+), 84 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 87192eb2d..98f5666ef 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8106,18 +8106,109 @@ virDomainDiskSourcePoolDefParse(xmlNodePtr node,
}
-int
-virDomainDiskSourceParse(xmlNodePtr node,
- xmlXPathContextPtr ctxt,
- virStorageSourcePtr src,
- unsigned int flags)
+static int
+virDomainDiskSourceNetworkParse(xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
+ virStorageSourcePtr src,
+ unsigned int flags)
{
- int ret = -1;
char *protocol = NULL;
- xmlNodePtr saveNode = ctxt->node;
char *haveTLS = NULL;
char *tlsCfg = NULL;
int tlsCfgVal;
+ int ret = -1;
+
+ if (!(protocol = virXMLPropString(node, "protocol"))) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing network source protocol type"));
+ goto cleanup;
+ }
+
+ if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) <= 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown protocol type '%s'"), protocol);
+ goto cleanup;
+ }
+
+ if (!(src->path = virXMLPropString(node, "name")) &&
+ src->protocol != VIR_STORAGE_NET_PROTOCOL_NBD) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("missing name for disk source"));
+ goto cleanup;
+ }
+
+ /* Check tls=yes|no domain setting for the block device
+ * At present only VxHS. Other block devices may be added later */
+ if (src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&
+ (haveTLS = virXMLPropString(node, "tls"))) {
+ if ((src->haveTLS =
+ virTristateBoolTypeFromString(haveTLS)) <= 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("unknown disk source 'tls' setting '%s'"),
+ haveTLS);
+ goto cleanup;
+ }
+ }
+
+ if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
+ (tlsCfg = virXMLPropString(node, "tlsFromConfig"))) {
+ if (virStrToLong_i(tlsCfg, NULL, 10, &tlsCfgVal) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid tlsFromConfig value: %s"),
+ tlsCfg);
+ goto cleanup;
+ }
+ src->tlsFromConfig = !!tlsCfgVal;
+ }
+
+ /* for historical reasons the volume name for gluster volume is stored
+ * as a part of the path. This is hard to work with when dealing with
+ * relative names. Split out the volume into a separate variable */
+ if (src->path && src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
+ char *tmp;
+ if (!(tmp = strchr(src->path, '/')) ||
+ tmp == src->path) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("missing volume name or file name in "
+ "gluster source path '%s'"), src->path);
+ goto cleanup;
+ }
+
+ src->volume = src->path;
+
+ if (VIR_STRDUP(src->path, tmp) < 0)
+ goto cleanup;
+
+ tmp[0] = '\0';
+ }
+
+ /* snapshot currently works only for remote disks */
+ src->snapshot = virXPathString("string(./snapshot/@name)", ctxt);
+
+ /* config file currently only works with remote disks */
+ src->configFile = virXPathString("string(./config/@file)", ctxt);
+
+ if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
+ goto cleanup;
+
+ virStorageSourceNetworkAssignDefaultPorts(src);
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(protocol);
+ return ret;
+}
+
+
+int
+virDomainDiskSourceParse(xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
+ virStorageSourcePtr src,
+ unsigned int flags)
+{
+ int ret = -1;
+ xmlNodePtr saveNode = ctxt->node;
ctxt->node = node;
@@ -8132,81 +8223,8 @@ virDomainDiskSourceParse(xmlNodePtr node,
src->path = virXMLPropString(node, "dir");
break;
case VIR_STORAGE_TYPE_NETWORK:
- if (!(protocol = virXMLPropString(node, "protocol"))) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing network source protocol type"));
+ if (virDomainDiskSourceNetworkParse(node, ctxt, src, flags) < 0)
goto cleanup;
- }
-
- if ((src->protocol = virStorageNetProtocolTypeFromString(protocol)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown protocol type '%s'"), protocol);
- goto cleanup;
- }
-
- if (!(src->path = virXMLPropString(node, "name")) &&
- src->protocol != VIR_STORAGE_NET_PROTOCOL_NBD) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("missing name for disk source"));
- goto cleanup;
- }
-
- /* Check tls=yes|no domain setting for the block device
- * At present only VxHS. Other block devices may be added later */
- if (src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&
- (haveTLS = virXMLPropString(node, "tls"))) {
- if ((src->haveTLS =
- virTristateBoolTypeFromString(haveTLS)) <= 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("unknown disk source 'tls' setting '%s'"),
- haveTLS);
- goto cleanup;
- }
- }
-
- if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
- (tlsCfg = virXMLPropString(node, "tlsFromConfig"))) {
- if (virStrToLong_i(tlsCfg, NULL, 10, &tlsCfgVal) < 0) {
- virReportError(VIR_ERR_XML_ERROR,
- _("Invalid tlsFromConfig value: %s"),
- tlsCfg);
- goto cleanup;
- }
- src->tlsFromConfig = !!tlsCfgVal;
- }
-
- /* for historical reasons the volume name for gluster volume is stored
- * as a part of the path. This is hard to work with when dealing with
- * relative names. Split out the volume into a separate variable */
- if (src->path && src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
- char *tmp;
- if (!(tmp = strchr(src->path, '/')) ||
- tmp == src->path) {
- virReportError(VIR_ERR_XML_ERROR,
- _("missing volume name or file name in "
- "gluster source path '%s'"), src->path);
- goto cleanup;
- }
-
- src->volume = src->path;
-
- if (VIR_STRDUP(src->path, tmp) < 0)
- goto cleanup;
-
- tmp[0] = '\0';
- }
-
- /* snapshot currently works only for remote disks */
- src->snapshot = virXPathString("string(./snapshot/@name)", ctxt);
-
- /* config file currently only works with remote disks */
- src->configFile = virXPathString("string(./config/@file)", ctxt);
-
- if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
- goto cleanup;
-
- virStorageSourceNetworkAssignDefaultPorts(src);
-
break;
case VIR_STORAGE_TYPE_VOLUME:
if (virDomainDiskSourcePoolDefParse(node, &src->srcpool) < 0)
@@ -8229,9 +8247,6 @@ virDomainDiskSourceParse(xmlNodePtr node,
ret = 0;
cleanup:
- VIR_FREE(protocol);
- VIR_FREE(haveTLS);
- VIR_FREE(tlsCfg);
ctxt->node = saveNode;
return ret;
}
--
2.14.1
7 years
[libvirt] [PATCH] Revert "vhost-user: add support reconnect for vhost-user ports"
by Pavel Hrdina
This reverts commit edaf4ebe95a5995585c8ab7bc5b92887286d4431.
This uses "reconnect" as attribute for <source> element, but we already
have a <reconnect> element for <source> element for chardev devices.
Since this is the same feature for different device it should be
presented in XML the same way.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
docs/formatdomain.html.in | 5 +---
docs/schemas/domaincommon.rng | 5 ----
src/conf/domain_conf.c | 28 ++--------------------
.../qemuxml2argv-net-vhostuser-multiq.args | 2 +-
.../qemuxml2argv-net-vhostuser-multiq.xml | 2 +-
5 files changed, 5 insertions(+), 37 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 1602ed3e95..9ce4620c65 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5673,7 +5673,7 @@ qemu-kvm -net nic,model=? /dev/null
</interface>
<interface type='vhostuser'>
<mac address='52:54:00:3b:83:1b'/>
- <source type='unix' path='/tmp/vhost2.sock' mode='client' reconnect='10'/>
+ <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
<model type='virtio'/>
<driver queues='5'/>
</interface>
@@ -5689,9 +5689,6 @@ qemu-kvm -net nic,model=? /dev/null
are supported.
vhost-user requires the virtio model type, thus the
<code><model></code> element is mandatory.
- <span class="since">Since 3.7.0</span> the element has an optional
- attribute <code>reconnect</code> which configures reconnect timeout
- (in seconds) if the connection is lost.
</p>
<h5><a id="elementNwfilter">Traffic filtering with NWFilter</a></h5>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 36e2966f21..76852abb3c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2388,11 +2388,6 @@
<value>client</value>
</choice>
</attribute>
- <optional>
- <attribute name="reconnect">
- <ref name='positiveInteger'/>
- </attribute>
- </optional>
<empty/>
</element>
<ref name="interface-options"/>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f3b4dd33da..cc5e79b70b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10240,7 +10240,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
char *vhostuser_mode = NULL;
char *vhostuser_path = NULL;
char *vhostuser_type = NULL;
- char *vhostuser_reconnect = NULL;
char *trustGuestRxFilters = NULL;
char *vhost_path = NULL;
virNWFilterHashTablePtr filterparams = NULL;
@@ -10327,12 +10326,11 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
} else if (!vhostuser_path && !vhostuser_mode && !vhostuser_type
- && !vhostuser_reconnect && def->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER
- && virXMLNodeNameEqual(cur, "source")) {
+ && def->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
+ virXMLNodeNameEqual(cur, "source")) {
vhostuser_type = virXMLPropString(cur, "type");
vhostuser_path = virXMLPropString(cur, "path");
vhostuser_mode = virXMLPropString(cur, "mode");
- vhostuser_reconnect = virXMLPropString(cur, "reconnect");
} else if (!def->virtPortProfile
&& virXMLNodeNameEqual(cur, "virtualport")) {
if (def->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
@@ -10554,24 +10552,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
if (STREQ(vhostuser_mode, "server")) {
def->data.vhostuser->data.nix.listen = true;
- if (vhostuser_reconnect) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("'reconnect' attribute unsupported "
- "'server' mode for <interface type='vhostuser'>"));
- goto error;
- }
} else if (STREQ(vhostuser_mode, "client")) {
def->data.vhostuser->data.nix.listen = false;
- if (vhostuser_reconnect) {
- def->data.vhostuser->data.nix.reconnect.enabled = true;
- if (virStrToLong_ui(vhostuser_reconnect, NULL, 10,
- &def->data.vhostuser->data.nix.reconnect.timeout) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid vhostuser reconnect value %s"),
- vhostuser_reconnect);
- goto error;
- }
- }
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Wrong <source> 'mode' attribute "
@@ -11016,7 +10998,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
VIR_FREE(portgroup);
VIR_FREE(address);
VIR_FREE(port);
- VIR_FREE(vhostuser_reconnect);
VIR_FREE(vhostuser_type);
VIR_FREE(vhostuser_path);
VIR_FREE(vhostuser_mode);
@@ -23002,11 +22983,6 @@ virDomainNetDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " mode='%s'",
def->data.vhostuser->data.nix.listen ?
"server" : "client");
- if (def->data.vhostuser->data.nix.reconnect.enabled == true) {
- virBufferAsprintf(buf, " reconnect='%u'",
- def->data.vhostuser->data.nix.reconnect.timeout);
- }
-
sourceLines++;
}
break;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
index 996828f7d8..b69ebd8bad 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.args
@@ -32,7 +32,7 @@ addr=0x4 \
-netdev socket,listen=:2015,id=hostnet2 \
-device rtl8139,netdev=hostnet2,id=net2,mac=52:54:00:95:db:c0,bus=pci.0,\
addr=0x5 \
--chardev socket,id=charnet3,path=/tmp/vhost2.sock,reconnect=10 \
+-chardev socket,id=charnet3,path=/tmp/vhost2.sock \
-netdev vhost-user,chardev=charnet3,queues=4,id=hostnet3 \
-device virtio-net-pci,mq=on,vectors=10,netdev=hostnet3,id=net3,\
mac=52:54:00:ee:96:6d,bus=pci.0,addr=0x6
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
index 7eb6fa0bbf..d5c42fe62c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-vhostuser-multiq.xml
@@ -40,7 +40,7 @@
</interface>
<interface type='vhostuser'>
<mac address='52:54:00:ee:96:6d'/>
- <source type='unix' path='/tmp/vhost2.sock' mode='client' reconnect='10'/>
+ <source type='unix' path='/tmp/vhost2.sock' mode='client'/>
<model type='virtio'/>
<driver queues='4'/>
</interface>
--
2.13.5
7 years
[libvirt] [PATCH python] Unify whitespace around *_ALLOW_THREADS macros
by Nir Soffer
Most of the code treats libvirt API calls as separate block, keeping one
blank line before the LIBVIRT_BEGIN_ALLOW_THREAD, and one blank line
after LIBVIRT_END_ALLOW_THREADS. Unify the whitespace so all calls
wrapped with these macros are treated as a separate block.
---
libvirt-override.c | 115 ++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 87 insertions(+), 28 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index f5ff605..d746350 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -441,6 +441,7 @@ libvirt_virDomainGetSchedulerType(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetSchedulerType(domain, &nparams);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval == NULL)
return VIR_PY_NONE;
@@ -1221,6 +1222,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
i_retval = virDomainGetInfo(domain, &dominfo);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0)
return VIR_PY_NONE;
@@ -1239,6 +1241,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
cpuinfo, dominfo.nrVirtCpu,
cpumap, cpumaplen);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0) {
error = VIR_PY_NONE;
goto cleanup;
@@ -1402,6 +1405,7 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
i_retval = virDomainGetInfo(domain, &dominfo);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0)
return VIR_PY_NONE;
@@ -1522,6 +1526,7 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
ret = virDomainGetEmulatorPinInfo(domain, cpumap, cpumaplen, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (ret < 0) {
VIR_FREE(cpumap);
return VIR_PY_NONE;
@@ -1660,6 +1665,7 @@ libvirt_virDomainPinIOThread(PyObject *self ATTRIBUTE_UNUSED,
i_retval = virDomainPinIOThread(domain, iothread_val,
cpumap, cpumaplen, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (i_retval < 0) {
ret = VIR_PY_INT_FAIL;
goto cleanup;
@@ -1728,6 +1734,7 @@ libvirt_virConnGetLastError(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
err = virConnGetLastError(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (err == NULL)
return VIR_PY_NONE;
@@ -1970,9 +1977,9 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED,
auth.cbdata = pyauth;
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectOpenAuth(name, &auth, flags);
LIBVIRT_END_ALLOW_THREADS;
+
VIR_FREE(auth.credtype);
py_retval = libvirt_virConnectPtrWrap((virConnectPtr) c_retval);
return py_retval;
@@ -1997,12 +2004,10 @@ libvirt_virGetVersion(PyObject *self ATTRIBUTE_UNUSED,
return NULL;
LIBVIRT_BEGIN_ALLOW_THREADS;
-
if (type == NULL)
c_retval = virGetVersion(&libVer, NULL, NULL);
else
c_retval = virGetVersion(&libVer, type, &typeVer);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2029,9 +2034,7 @@ libvirt_virConnectGetVersion(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectGetVersion(conn, &hvVersion);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2059,9 +2062,7 @@ libvirt_virConnectGetCPUModelNames(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectGetCPUModelNames(conn, arch, &models, flags);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2103,9 +2104,7 @@ libvirt_virConnectGetLibVersion(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
c_retval = virConnectGetLibVersion(conn, &libVer);
-
LIBVIRT_END_ALLOW_THREADS;
if (c_retval == -1)
@@ -2132,6 +2131,7 @@ libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfDomains(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2142,6 +2142,7 @@ libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListDomains(conn, ids, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -2186,6 +2187,7 @@ libvirt_virConnectListAllDomains(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllDomains(conn, &doms, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2231,15 +2233,18 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfDefinedDomains(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListDefinedDomains(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -2287,15 +2292,18 @@ libvirt_virDomainSnapshotListNames(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainSnapshotNum(dom, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainSnapshotListNames(dom, names, c_retval, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -2341,6 +2349,7 @@ libvirt_virDomainListAllSnapshots(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainListAllSnapshots(dom, &snaps, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2386,16 +2395,19 @@ libvirt_virDomainSnapshotListChildrenNames(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainSnapshotNumChildren(snap, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainSnapshotListChildrenNames(snap, names, c_retval,
flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -2441,6 +2453,7 @@ libvirt_virDomainSnapshotListAllChildren(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainSnapshotListAllChildren(parent, &snaps, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2484,6 +2497,7 @@ libvirt_virDomainRevertToSnapshot(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainRevertToSnapshot(snap, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_INT_FAIL;
@@ -2507,6 +2521,7 @@ libvirt_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetInfo(domain, &info);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2549,6 +2564,7 @@ libvirt_virDomainGetState(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetState(domain, &state, &reason, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2584,6 +2600,7 @@ libvirt_virDomainGetControlInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetControlInfo(domain, &info, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2622,6 +2639,7 @@ libvirt_virDomainGetBlockInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetBlockInfo(domain, path, &info, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2659,6 +2677,7 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeGetInfo(conn, &info);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2701,6 +2720,7 @@ libvirt_virNodeGetSecurityModel(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeGetSecurityModel(conn, &model);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2737,6 +2757,7 @@ libvirt_virDomainGetSecurityLabel(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetSecurityLabel(dom, &label);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -2823,6 +2844,7 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED,
if (domain == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetUUID(domain, &uuid[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -2849,6 +2871,7 @@ libvirt_virDomainGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (dom == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetUUIDString(dom, &uuidstr[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -2905,15 +2928,18 @@ libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfNetworks(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListNetworks(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -2961,15 +2987,18 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfDefinedNetworks(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListDefinedNetworks(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -3016,6 +3045,7 @@ libvirt_virConnectListAllNetworks(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllNetworks(conn, &nets, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3057,6 +3087,7 @@ libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED,
if (domain == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNetworkGetUUID(domain, &uuid[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -3083,6 +3114,7 @@ libvirt_virNetworkGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (net == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNetworkGetUUIDString(net, &uuidstr[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -3238,6 +3270,7 @@ libvirt_virNodeGetCPUStats(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeGetCPUStats(conn, cpuNum, NULL, &nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3248,6 +3281,7 @@ libvirt_virNodeGetCPUStats(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeGetCPUStats(conn, cpuNum, stats, &nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
VIR_FREE(stats);
return VIR_PY_NONE;
@@ -3296,6 +3330,7 @@ libvirt_virNodeGetMemoryStats(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeGetMemoryStats(conn, cellNum, NULL, &nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3306,6 +3341,7 @@ libvirt_virNodeGetMemoryStats(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeGetMemoryStats(conn, cellNum, stats, &nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
VIR_FREE(stats);
return VIR_PY_NONE;
@@ -3350,15 +3386,18 @@ libvirt_virConnectListStoragePools(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfStoragePools(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListStoragePools(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -3404,15 +3443,18 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfDefinedStoragePools(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListDefinedStoragePools(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -3461,6 +3503,7 @@ libvirt_virConnectListAllStoragePools(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllStoragePools(conn, &pools, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3506,6 +3549,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStoragePoolNumOfVolumes(pool);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3516,6 +3560,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStoragePoolListVolumes(pool, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -3564,6 +3609,7 @@ libvirt_virStoragePoolListAllVolumes(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStoragePoolListAllVolumes(pool, &vols, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3632,6 +3678,7 @@ libvirt_virStoragePoolGetInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStoragePoolGetInfo(pool, &info);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3672,6 +3719,7 @@ libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStorageVolGetInfo(pool, &info);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3711,6 +3759,7 @@ libvirt_virStorageVolGetInfoFlags(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStorageVolGetInfoFlags(pool, &info, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3747,6 +3796,7 @@ libvirt_virStoragePoolGetUUID(PyObject *self ATTRIBUTE_UNUSED,
if (pool == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStoragePoolGetUUID(pool, &uuid[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -3773,6 +3823,7 @@ libvirt_virStoragePoolGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (pool == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virStoragePoolGetUUIDString(pool, &uuidstr[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -3829,6 +3880,7 @@ libvirt_virNodeListDevices(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeNumOfDevices(conn, cap, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3887,6 +3939,7 @@ libvirt_virConnectListAllNodeDevices(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllNodeDevices(conn, &devices, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -3931,15 +3984,18 @@ libvirt_virNodeDeviceListCaps(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeDeviceNumOfCaps(dev);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(names, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNodeDeviceListCaps(dev, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -3981,6 +4037,7 @@ libvirt_virSecretGetUUID(PyObject *self ATTRIBUTE_UNUSED,
if (secret == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virSecretGetUUID(secret, &uuid[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -4007,6 +4064,7 @@ libvirt_virSecretGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (dom == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virSecretGetUUIDString(dom, &uuidstr[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -4061,15 +4119,18 @@ libvirt_virConnectListSecrets(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfSecrets(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
if (c_retval) {
if (VIR_ALLOC_N(uuids, c_retval) < 0)
return PyErr_NoMemory();
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListSecrets(conn, uuids, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -4118,6 +4179,7 @@ libvirt_virConnectListAllSecrets(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllSecrets(conn, &secrets, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4213,6 +4275,7 @@ libvirt_virNWFilterGetUUID(PyObject *self ATTRIBUTE_UNUSED,
if (nwfilter == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNWFilterGetUUID(nwfilter, &uuid[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -4239,6 +4302,7 @@ libvirt_virNWFilterGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (nwfilter == NULL)
return VIR_PY_NONE;
+
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virNWFilterGetUUIDString(nwfilter, &uuidstr[0]);
LIBVIRT_END_ALLOW_THREADS;
@@ -4294,6 +4358,7 @@ libvirt_virConnectListNWFilters(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfNWFilters(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4304,6 +4369,7 @@ libvirt_virConnectListNWFilters(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListNWFilters(conn, uuids, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -4351,6 +4417,7 @@ libvirt_virConnectListAllNWFilters(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllNWFilters(conn, &filters, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4397,6 +4464,7 @@ libvirt_virConnectListInterfaces(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfInterfaces(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4407,6 +4475,7 @@ libvirt_virConnectListInterfaces(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListInterfaces(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -4454,6 +4523,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectNumOfDefinedInterfaces(conn);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4464,6 +4534,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListDefinedInterfaces(conn, names, c_retval);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0) {
py_retval = VIR_PY_NONE;
goto cleanup;
@@ -4513,6 +4584,7 @@ libvirt_virConnectListAllInterfaces(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virConnectListAllInterfaces(conn, &ifaces, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4610,6 +4682,7 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainGetJobInfo(domain, &info);
LIBVIRT_END_ALLOW_THREADS;
+
if (c_retval < 0)
return VIR_PY_NONE;
@@ -4670,6 +4743,7 @@ libvirt_virDomainGetJobStats(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
rc = virDomainGetJobStats(domain, &type, ¶ms, &nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (rc < 0)
return VIR_PY_NONE;
@@ -5147,11 +5221,9 @@ libvirt_virConnectDomainEventRegister(ATTRIBUTE_UNUSED PyObject *self,
Py_INCREF(pyobj_conn_inst);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectDomainEventRegister(conn,
libvirt_virConnectDomainEventCallback,
pyobj_conn_inst, NULL);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
@@ -5176,9 +5248,7 @@ libvirt_virConnectDomainEventDeregister(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectDomainEventDeregister(conn, libvirt_virConnectDomainEventCallback);
-
LIBVIRT_END_ALLOW_THREADS;
Py_DECREF(pyobj_conn_inst);
@@ -5464,18 +5534,16 @@ libvirt_virEventRegisterImpl(PyObject *self ATTRIBUTE_UNUSED,
Py_INCREF(updateTimeoutObj);
Py_INCREF(removeTimeoutObj);
- LIBVIRT_BEGIN_ALLOW_THREADS;
-
/* Now register our C EventImpl, which will dispatch
* to the Python callbacks passed in as args.
*/
+ LIBVIRT_BEGIN_ALLOW_THREADS;
virEventRegisterImpl(libvirt_virEventAddHandleFunc,
libvirt_virEventUpdateHandleFunc,
libvirt_virEventRemoveHandleFunc,
libvirt_virEventAddTimeoutFunc,
libvirt_virEventUpdateTimeoutFunc,
libvirt_virEventRemoveTimeoutFunc);
-
LIBVIRT_END_ALLOW_THREADS;
return VIR_PY_INT_SUCCESS;
@@ -7155,9 +7223,7 @@ libvirt_virConnectDomainEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectDomainEventDeregisterAny(conn, callbackID);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
@@ -7299,9 +7365,7 @@ libvirt_virConnectNetworkEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectNetworkEventDeregisterAny(conn, callbackID);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
@@ -7397,10 +7461,8 @@ libvirt_virConnectUnregisterCloseCallback(PyObject * self ATTRIBUTE_UNUSED,
conn = PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectUnregisterCloseCallback(conn,
libvirt_virConnectCloseCallbackDispatch);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
@@ -8036,6 +8098,7 @@ libvirt_virDomainCreateWithFiles(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainCreateWithFiles(domain, nfiles, files, flags);
LIBVIRT_END_ALLOW_THREADS;
+
py_retval = libvirt_intWrap((int) c_retval);
cleanup:
@@ -8084,6 +8147,7 @@ libvirt_virDomainCreateXMLWithFiles(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
c_retval = virDomainCreateXMLWithFiles(conn, xmlDesc, nfiles, files, flags);
LIBVIRT_END_ALLOW_THREADS;
+
py_retval = libvirt_virDomainPtrWrap((virDomainPtr) c_retval);
cleanup:
@@ -8772,6 +8836,7 @@ libvirt_virDomainGetPerfEvents(PyObject *self ATTRIBUTE_UNUSED,
LIBVIRT_BEGIN_ALLOW_THREADS;
rc = virDomainGetPerfEvents(domain, ¶ms, &nparams, flags);
LIBVIRT_END_ALLOW_THREADS;
+
if (rc < 0)
return VIR_PY_NONE;
@@ -9040,9 +9105,7 @@ libvirt_virConnectStoragePoolEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectStoragePoolEventDeregisterAny(conn, callbackID);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
@@ -9275,9 +9338,7 @@ libvirt_virConnectNodeDeviceEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectNodeDeviceEventDeregisterAny(conn, callbackID);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
@@ -9475,9 +9536,7 @@ libvirt_virConnectSecretEventDeregisterAny(PyObject *self ATTRIBUTE_UNUSED,
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
-
ret = virConnectSecretEventDeregisterAny(conn, callbackID);
-
LIBVIRT_END_ALLOW_THREADS;
return libvirt_intWrap(ret);
--
2.9.5
7 years
[libvirt] RFC: Detaching interface from guest fails with improper error message if no mac given in xml
by Madhu Pavan
This RFC is regarding https://bugzilla.redhat.com/show_bug.cgi?id=1497054
Let's say we have a network interface
<interface type='network'>
<mac address='52:54:00:fe:10:57'/>
<source network='vfnetwork'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x01'
function='0x0'/>
</interface>
and we are trying to detach the above interface with the following
xml(vfpool.xml):
<interface type='network'>
<source network='vfnetwork'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x01'
function='0x0'/>
</interface>
Detaching the interface returns error:
# virsh detach-device vffuest vfpool.xml
error: Failed to detach device from vfpool.xml
error: operation failed: no device matching mac address
52:54:00:54:f6:61 found
Here the mac address is auto-generated as we haven't given in the
vfpool.xml.
And virDomainNetFindIdx will try to match the auto-generated mac address
with
the domain xml. It fails as there will be no match and the error message
says
"no device matching mac address 52:54:00:54:f6:61 found".
Here in this scenario I see two possible improvements.
1. As virDomainNetFindIdx search according to mac address and guest side
PCI address (if specified), we can search for PCI address and avoid
mac address search if mac is not given in the xml. As the PCI address
is unique we don't compromise in performance.
2. Improve error message by saying mac address is missing in the device xml.
7 years
[libvirt] [PATCH go-xml] Add support for memory device element
by zhenwei.pi
Support model, access and target.
Add Marshal/Unmarshal mothed for memory device.
Add test code for device list in full domain.
Signed-off-by: zhenwei.pi <zhenwei.pi(a)youruncloud.com>
---
domain.go | 29 +++++++++++++++++++++++++++++
domain_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/domain.go b/domain.go
index 8c2cc1b..bacab11 100644
--- a/domain.go
+++ b/domain.go
@@ -436,6 +436,22 @@ type DomainHostdev struct {
Address *DomainAddress `xml:"address"`
}
+type DomainMemorydevTargetNode struct {
+ Value uint `xml:",chardata"`
+}
+
+type DomainMemorydevTarget struct {
+ Size *DomainMemory `xml:"size"`
+ Node *DomainMemorydevTargetNode `xml:"node"`
+}
+
+type DomainMemorydev struct {
+ XMLName xml.Name `xml:"memory"`
+ Model string `xml:"model,attr"`
+ Access string `xml:"access,attr"`
+ Target *DomainMemorydevTarget `xml:"target"`
+}
+
type DomainDeviceList struct {
Emulator string `xml:"emulator,omitempty"`
Controllers []DomainController `xml:"controller"`
@@ -452,6 +468,7 @@ type DomainDeviceList struct {
Sounds []DomainSound `xml:"sound"`
RNGs []DomainRNG `xml:"rng"`
Hostdevs []DomainHostdev `xml:"hostdev"`
+ Memorydevs []DomainMemorydev `xml:"memory"`
}
type DomainMemory struct {
@@ -915,6 +932,18 @@ func (d *DomainHostdev) Marshal() (string, error) {
return string(doc), nil
}
+func (d *DomainMemorydev) Unmarshal(doc string) error {
+ return xml.Unmarshal([]byte(doc), d)
+}
+
+func (d *DomainMemorydev) Marshal() (string, error) {
+ doc, err := xml.MarshalIndent(d, "", " ")
+ if err != nil {
+ return "", err
+ }
+ return string(doc), nil
+}
+
type HexUint uint
func (h *HexUint) UnmarshalXMLAttr(attr xml.Attr) error {
diff --git a/domain_test.go b/domain_test.go
index 4fe6bfe..dbebe42 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -372,6 +372,21 @@ var domainTestData = []struct {
},
},
},
+ Memorydevs: []DomainMemorydev{
+ DomainMemorydev{
+ Model: "dimm",
+ Access: "private",
+ Target: &DomainMemorydevTarget{
+ Size: &DomainMemory{
+ Value: 1,
+ Unit: "GiB",
+ },
+ Node: &DomainMemorydevTargetNode{
+ Value: 0,
+ },
+ },
+ },
+ },
},
},
Expected: []string{
@@ -414,6 +429,12 @@ var domainTestData = []struct {
` <source mode="connect" service="1234" host="1.2.3.4"></source>`,
` </backend>`,
` </rng>`,
+ ` <memory model="dimm" access="private">`,
+ ` <target>`,
+ ` <size unit="GiB">1</size>`,
+ ` <node>0</node>`,
+ ` </target>`,
+ ` </memory>`,
` </devices>`,
`</domain>`,
},
@@ -1630,6 +1651,30 @@ var domainTestData = []struct {
`</hostdev>`,
},
},
+ {
+ Object: &DomainMemorydev{
+ Model: "dimm",
+ Access: "private",
+ Target: &DomainMemorydevTarget{
+ Size: &DomainMemory{
+ Value: 1,
+ Unit: "GiB",
+ },
+ Node: &DomainMemorydevTargetNode{
+ Value: 0,
+ },
+ },
+ },
+
+ Expected: []string{
+ `<memory model="dimm" access="private">`,
+ ` <target>`,
+ ` <size unit="GiB">1</size>`,
+ ` <node>0</node>`,
+ ` </target>`,
+ `</memory>`,
+ },
+ },
}
func TestDomain(t *testing.T) {
--
2.7.4
7 years
[libvirt] [PATCH] Fix vxhs test to have stable certificate dir
by Daniel P. Berrange
The test suite has hardcoded /etc/pki/qemu as the cert dir, but this
only works if configure has --sysconfdir=/etc passed. We must set the
vxhs cert dir to a stable path in the test suite.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
Pushed as a build fix
.../qemuxml2argv-disk-drive-network-tlsx509-vxhs.args | 4 ++--
tests/qemuxml2argvtest.c | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-tlsx509-vxhs.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-tlsx509-vxhs.args
index 572c9f36c..a75272454 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-tlsx509-vxhs.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-tlsx509-vxhs.args
@@ -20,7 +20,7 @@ server,nowait \
-no-acpi \
-boot c \
-usb \
--object tls-creds-x509,id=objvirtio-disk0_tls0,dir=/etc/pki/qemu,\
+-object tls-creds-x509,id=objvirtio-disk0_tls0,dir=/etc/pki/libvirt-vxhs,\
endpoint=client,verify-peer=yes \
-drive file.driver=vxhs,file.tls-creds=objvirtio-disk0_tls0,\
file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc251,file.server.type=tcp,\
@@ -28,7 +28,7 @@ file.server.host=192.168.0.1,file.server.port=9999,format=raw,if=none,\
id=drive-virtio-disk0,cache=none \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
id=virtio-disk0 \
--object tls-creds-x509,id=objvirtio-disk1_tls0,dir=/etc/pki/qemu,\
+-object tls-creds-x509,id=objvirtio-disk1_tls0,dir=/etc/pki/libvirt-vxhs,\
endpoint=client,verify-peer=yes \
-drive file.driver=vxhs,file.tls-creds=objvirtio-disk1_tls0,\
file.vdisk-id=eb90327c-8302-4725-9e1b-4e85ed4dc252,file.server.type=tcp,\
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1958ad428..7271ea07e 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -599,6 +599,9 @@ mymain(void)
VIR_FREE(driver.config->chardevTLSx509certdir);
if (VIR_STRDUP_QUIET(driver.config->chardevTLSx509certdir, "/etc/pki/libvirt-chardev") < 0)
return EXIT_FAILURE;
+ VIR_FREE(driver.config->vxhsTLSx509certdir);
+ if (VIR_STRDUP_QUIET(driver.config->vxhsTLSx509certdir, "/etc/pki/libvirt-vxhs") < 0)
+ return EXIT_FAILURE;
VIR_FREE(driver.config->hugetlbfs);
if (VIR_ALLOC_N(driver.config->hugetlbfs, 2) < 0)
--
2.13.5
7 years
[libvirt] [PATCH v10 0/5] Add support for Veritas HyperScale (VxHS) block device protocol
by John Ferlan
v9: https://www.redhat.com/archives/libvir-list/2017-September/msg00641.html
Differences to v9:
* Patch 1:
- Clean up the wording from code review
* Patch 2: (NEW)
- Split out the formatting change for source/prototcol
* Patch 3:
- Add the parsing of the tlsFromConfig for storage source - this
just follows what chardev has done.
* Patch 4:
- Remove the src->tlsListen
* Patch 5:
- Remove the validation (from code review)
- Remove the comments in qemuDomainAddDiskSrcTLSObject
- Merge the -multi- test into the existing test - it was
easier than removing the existing and the using -multi-
Ashish Mittal (3):
conf: Introduce TLS options for VxHS block device clients
util: Add TLS attributes to virStorageSource
qemu: Add TLS support for Veritas HyperScale (VxHS)
John Ferlan (2):
docs: Clean up the description for network disk protocol options
qemu: Introduce qemuDomainPrepareDiskSource
docs/formatdomain.html.in | 40 +++++++++---
docs/schemas/domaincommon.rng | 5 ++
src/conf/domain_conf.c | 64 +++++++++++++++----
src/conf/domain_conf.h | 3 +-
src/conf/snapshot_conf.c | 7 ++-
src/qemu/libvirtd_qemu.aug | 4 ++
src/qemu/qemu.conf | 34 ++++++++++
src/qemu/qemu_block.c | 2 +
src/qemu/qemu_command.c | 33 ++++++++++
src/qemu/qemu_conf.c | 16 +++++
src/qemu/qemu_conf.h | 3 +
src/qemu/qemu_domain.c | 73 ++++++++++++++++++++++
src/qemu/qemu_domain.h | 11 ++++
src/qemu/qemu_hotplug.c | 73 ++++++++++++++++++++++
src/qemu/qemu_process.c | 4 ++
src/qemu/test_libvirtd_qemu.aug.in | 2 +
src/util/virstoragefile.c | 10 ++-
src/util/virstoragefile.h | 14 +++++
...muxml2argv-disk-drive-network-tlsx509-vxhs.args | 43 +++++++++++++
...emuxml2argv-disk-drive-network-tlsx509-vxhs.xml | 50 +++++++++++++++
tests/qemuxml2argvtest.c | 5 ++
...uxml2xmlout-disk-drive-network-tlsx509-vxhs.xml | 52 +++++++++++++++
tests/qemuxml2xmltest.c | 1 +
23 files changed, 523 insertions(+), 26 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-tlsx509-vxhs.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-tlsx509-vxhs.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-drive-network-tlsx509-vxhs.xml
--
2.13.5
7 years
Re: [libvirt] [Qemu-devel] [PATCH 1/2] vl: Eliminate defconfig variable
by Eduardo Habkost
(CCing libvir-list)
On Thu, Sep 28, 2017 at 12:42:02PM +0100, Daniel P. Berrange wrote:
> On Wed, Sep 27, 2017 at 05:32:24PM -0300, Eduardo Habkost wrote:
> > Both -nodefconfig and -no-user-config options do the same thing
> > today, we only need one variable to keep track of them.
>
> What reason for picking -nodefconfig instead of -no-user-config to
> deprecate ? -nodefconfig predates -no-user-config by a few years,
> and is what libvirt has historically used. So from libvirt POV
> we'd have a slight preference to deprecate -no-user-config instead
> and keep -nodefconfig, simply to avoid need to add conditional
> logic to libvirt to pick which to use.
libvirt already prefers -no-user-config, which is the right thing
for libvirt because it needs a mechanism to disable user-provided
configuration only, not QEMU-provided data files (in case they
exist).
In other words, we have an important use case for the
-no-user-config semantics in libvirt, and I am not aware of any
existing user of the -nodefconfig semantics.
(For the record, I think the existing documented -nodefconfig
semantics is awful and useless, but that's the one we got. Old
discussions about this can be seen at:
https://www.mail-archive.com/libvir-list@redhat.com/msg53083.html )
>
> >
> > Suggested-by: Markus Armbruster <armbru(a)redhat.com>
> > Signed-off-by: Eduardo Habkost <ehabkost(a)redhat.com>
> > ---
> > vl.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/vl.c b/vl.c
> > index 4fd01fda91..b347a97a5b 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -3093,7 +3093,6 @@ int main(int argc, char **argv, char **envp)
> > const char *qtest_log = NULL;
> > const char *pid_file = NULL;
> > const char *incoming = NULL;
> > - bool defconfig = true;
> > bool userconfig = true;
> > bool nographic = false;
> > DisplayType display_type = DT_DEFAULT;
> > @@ -3194,8 +3193,6 @@ int main(int argc, char **argv, char **envp)
> > popt = lookup_opt(argc, argv, &optarg, &optind);
> > switch (popt->index) {
> > case QEMU_OPTION_nodefconfig:
> > - defconfig = false;
> > - break;
> > case QEMU_OPTION_nouserconfig:
> > userconfig = false;
> > break;
> > @@ -3203,7 +3200,7 @@ int main(int argc, char **argv, char **envp)
> > }
> > }
> >
> > - if (defconfig && userconfig) {
> > + if (userconfig) {
> > if (qemu_read_default_config_file() < 0) {
> > exit(1);
> > }
> > --
> > 2.13.5
> >
> >
>
> Regards,
> Daniel
> --
> |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org -o- https://fstop138.berrange.com :|
> |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
--
Eduardo
7 years