[libvirt] [libvirt-php 1/2] Add CFLAGS for compiler
by Lyre
The defualt CFLAGS is `-g -Wall'. We can change it with
./configure CFLAGS="your option". The `-g' options also make
it able to build debugsource & debuginfo packages.
---
src/Makefile.am | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 76ebee6..6fab5f0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,8 +8,8 @@ EXTRA_DIST = libvirt-php.c libvirt-php.h
all-am: build clean-temp
build:
- $(CC) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 $(PHPINC) -c -o $(PACKAGE).o libvirt-php.c $(LIBXML_CFLAGS) $(DEFINES)
- $(CC) -Wall -shared $(LIBS) -rdynamic -o $(PACKAGE).so $(PACKAGE).o -ldl -lvirt $(LIBXML_LIBS)
+ $(CC) $(CFLAGS) -fpic -DCOMPILE_DL_LIBVIRT=1 $(PHPINC) -c -o $(PACKAGE).o libvirt-php.c $(LIBXML_CFLAGS) $(DEFINES)
+ $(CC) $(CFLAGS) -shared $(LIBS) -rdynamic -o $(PACKAGE).so $(PACKAGE).o -ldl -lvirt $(LIBXML_LIBS)
$(ECHO) "Extension compiled as $(PACKAGE).so"
install-exec-local:
--
1.7.3.4
13 years, 8 months
[libvirt] [PATCH] Introduce virDomainChrDefNew()
by Michal Novotny
Hi,
this is the commit to introduce the function to create new character
device definition for the domain as advices by Cole Robinson
<crobinso(a)redhat.com>.
The function is used on the relevant places and the make, make check
and make syntax-check all passed.
Michal
Signed-off-by: Michal Novotny <minovotn(a)redhat.com>
Signed-off-by: Michal Novotny <mignov(a)gmail.com>
---
src/conf/domain_conf.c | 20 +++++++++++++++++---
src/conf/domain_conf.h | 2 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 3 ++-
src/xenxs/xen_xm.c | 3 ++-
5 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 90a1317..a80719c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3212,6 +3212,22 @@ error:
goto cleanup;
}
+/* Create a new character device definition and set
+ * default port.
+ */
+virDomainChrDefPtr
+virDomainChrDefNew(void) {
+ virDomainChrDefPtr def = NULL;
+
+ if (VIR_ALLOC(def) < 0) {
+ virReportOOMError();
+ return NULL;
+ }
+
+ def->target.port = -1;
+ return def;
+}
+
/* Parse the XML definition for a character device
* @param node XML nodeset to parse for net definition
*
@@ -3260,10 +3276,8 @@ virDomainChrDefParseXML(virCapsPtr caps,
virDomainChrDefPtr def;
int remaining;
- if (VIR_ALLOC(def) < 0) {
- virReportOOMError();
+ if (!(def = virDomainChrDefNew()))
return NULL;
- }
type = virXMLPropString(node, "type");
if (type == NULL) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 95bd11e..ecf44ca 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1229,6 +1229,8 @@ void virDomainObjRef(virDomainObjPtr vm);
/* Returns 1 if the object was freed, 0 if more refs exist */
int virDomainObjUnref(virDomainObjPtr vm) ATTRIBUTE_RETURN_CHECK;
+virDomainChrDefPtr virDomainChrDefNew(void);
+
/* live == true means def describes an active domain (being migrated or
* restored) as opposed to a new persistent configuration of the domain */
virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 54e4482..c13e416 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -333,6 +333,7 @@ virDomainWatchdogActionTypeFromString;
virDomainWatchdogActionTypeToString;
virDomainWatchdogModelTypeFromString;
virDomainWatchdogModelTypeToString;
+virDomainChrDefNew;
# domain_event.h
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fea0068..d258712 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -36,6 +36,7 @@
#include "c-ctype.h"
#include "domain_nwfilter.h"
#include "qemu_audit.h"
+#include "domain_conf.h"
#include <sys/utsname.h>
#include <sys/stat.h>
@@ -5315,7 +5316,7 @@ qemuParseCommandLineChr(const char *val)
{
virDomainChrDefPtr def;
- if (VIR_ALLOC(def) < 0)
+ if (!(def = virDomainChrDefNew()))
goto no_memory;
if (STREQ(val, "null")) {
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 22ad788..0b47f1f 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -36,6 +36,7 @@
#include "xenxs_private.h"
#include "xen_xm.h"
#include "xen_sxpr.h"
+#include "domain_conf.h"
/* Convenience method to grab a int from the config file object */
static int xenXMConfigGetBool(virConfPtr conf,
@@ -981,7 +982,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
continue;
}
- if (VIR_ALLOC(chr) < 0)
+ if (!(chr = virDomainChrDefNew()))
goto no_memory;
if (!(chr = xenParseSxprChar(port, NULL)))
goto cleanup;
--
1.7.3.2
13 years, 8 months
[libvirt] [PATCH V2] check whether domain is active after qemuDomainObjExitMonitor* returns
by Wen Congyang
qemu may quited unexpectedly when invoking a monitor command. And priv->mon
will be NULL after qemuDomainObjExitMonitor* returns. So we must not use it.
Unfortunately we still use it, and it will cause libvirtd crashed.
As Eric suggested, qemuDomainObjExitMonitor* should be made to return the value
of vm active after regaining lock, and marked ATTRIBUTE_RETURN_CHECK, to force
all other callers to detect the case of a monitor command completing successfully
but then the VM disappearing in the window between command completion and regaining
the vm lock.
---
src/qemu/qemu_domain.c | 28 +++++++-
src/qemu/qemu_domain.h | 6 +-
src/qemu/qemu_driver.c | 51 ++++++++------
src/qemu/qemu_hotplug.c | 177 ++++++++++++++++++++++-----------------------
src/qemu/qemu_migration.c | 73 +++++++++++--------
src/qemu/qemu_process.c | 38 ++++++----
6 files changed, 212 insertions(+), 161 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a947b4e..44ad6a3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -580,7 +580,7 @@ void qemuDomainObjEnterMonitor(virDomainObjPtr obj)
*
* Should be paired with an earlier qemuDomainObjEnterMonitor() call
*/
-void qemuDomainObjExitMonitor(virDomainObjPtr obj)
+int qemuDomainObjExitMonitor(virDomainObjPtr obj)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
int refs;
@@ -590,11 +590,22 @@ void qemuDomainObjExitMonitor(virDomainObjPtr obj)
if (refs > 0)
qemuMonitorUnlock(priv->mon);
+ /* Note: qemu may quited unexpectedly here, and the monitor will be freed.
+ * If it happened, priv->mon will be null.
+ */
+
virDomainObjLock(obj);
if (refs == 0) {
priv->mon = NULL;
}
+
+ if (priv->mon == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("guest unexpectedly quit"));
+ return -1;
+ } else
+ return 0;
}
@@ -623,8 +634,8 @@ void qemuDomainObjEnterMonitorWithDriver(struct qemud_driver *driver,
*
* Should be paired with an earlier qemuDomainObjEnterMonitorWithDriver() call
*/
-void qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
- virDomainObjPtr obj)
+int qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
+ virDomainObjPtr obj)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
int refs;
@@ -634,12 +645,23 @@ void qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
if (refs > 0)
qemuMonitorUnlock(priv->mon);
+ /* Note: qemu may quited unexpectedly here, and the monitor will be freed.
+ * If it happened, priv->mon will be null.
+ */
+
qemuDriverLock(driver);
virDomainObjLock(obj);
if (refs == 0) {
priv->mon = NULL;
}
+
+ if (priv->mon == NULL) {
+ qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("guest unexpectedly quit"));
+ return -1;
+ } else
+ return 0;
}
void qemuDomainObjEnterRemoteWithDriver(struct qemud_driver *driver,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 8258900..92fccda 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -99,11 +99,11 @@ int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
int qemuDomainObjEndJob(virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
void qemuDomainObjEnterMonitor(virDomainObjPtr obj);
-void qemuDomainObjExitMonitor(virDomainObjPtr obj);
+int qemuDomainObjExitMonitor(virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
void qemuDomainObjEnterMonitorWithDriver(struct qemud_driver *driver,
virDomainObjPtr obj);
-void qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
- virDomainObjPtr obj);
+int qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
+ virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
void qemuDomainObjEnterRemoteWithDriver(struct qemud_driver *driver,
virDomainObjPtr obj);
void qemuDomainObjExitRemoteWithDriver(struct qemud_driver *driver,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 04a5f65..cb9f3fa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1452,7 +1452,8 @@ static int qemudDomainShutdown(virDomainPtr dom) {
priv = vm->privateData;
qemuDomainObjEnterMonitor(vm);
ret = qemuMonitorSystemPowerdown(priv->mon);
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
endjob:
if (qemuDomainObjEndJob(vm) == 0)
@@ -1659,7 +1660,8 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
priv = vm->privateData;
qemuDomainObjEnterMonitor(vm);
r = qemuMonitorSetBalloon(priv->mon, newmem);
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ r = -1;
qemuAuditMemory(vm, vm->def->mem.cur_balloon, newmem, "update",
r == 1);
if (r < 0)
@@ -1749,7 +1751,8 @@ static int qemudDomainGetInfo(virDomainPtr dom,
else {
qemuDomainObjEnterMonitor(vm);
err = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ err = -1;
}
if (qemuDomainObjEndJob(vm) == 0) {
vm = NULL;
@@ -2524,7 +2527,8 @@ static int qemudDomainHotplugVcpus(virDomainObjPtr vm, unsigned int nvcpus)
ret = 0;
cleanup:
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
vm->def->vcpus = vcpus;
qemuAuditVcpu(vm, oldvcpus, nvcpus, "update", rc == 1);
return ret;
@@ -3295,7 +3299,8 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
err = qemuMonitorGetBalloonInfo(priv->mon, &balloon);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ err = -1;
if (qemuDomainObjEndJob(vm) == 0) {
vm = NULL;
goto cleanup;
@@ -4843,7 +4848,8 @@ qemudDomainBlockStats (virDomainPtr dom,
&stats->wr_req,
&stats->wr_bytes,
&stats->errs);
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
endjob:
if (qemuDomainObjEndJob(vm) == 0)
@@ -4944,7 +4950,8 @@ qemudDomainMemoryStats (virDomainPtr dom,
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuDomainObjEnterMonitor(vm);
ret = qemuMonitorGetMemoryStats(priv->mon, stats, nr_stats);
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
} else {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
@@ -5085,17 +5092,15 @@ qemudDomainMemoryPeek (virDomainPtr dom,
priv = vm->privateData;
qemuDomainObjEnterMonitor(vm);
if (flags == VIR_MEMORY_VIRTUAL) {
- if (qemuMonitorSaveVirtualMemory(priv->mon, offset, size, tmp) < 0) {
- qemuDomainObjExitMonitor(vm);
- goto endjob;
- }
+ ret = qemuMonitorSaveVirtualMemory(priv->mon, offset, size, tmp);
} else {
- if (qemuMonitorSavePhysicalMemory(priv->mon, offset, size, tmp) < 0) {
- qemuDomainObjExitMonitor(vm);
- goto endjob;
- }
+ ret = qemuMonitorSavePhysicalMemory(priv->mon, offset, size, tmp);
}
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
+
+ if (ret < -1)
+ goto endjob;
/* Read the memory file into buffer. */
if (saferead (fd, buffer, size) == (ssize_t) -1) {
@@ -5259,7 +5264,8 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
ret = qemuMonitorGetBlockExtent(priv->mon,
disk->info.alias,
&info->allocation);
- qemuDomainObjExitMonitor(vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
}
if (qemuDomainObjEndJob(vm) == 0)
@@ -6101,7 +6107,8 @@ qemuDomainSnapshotCreateActive(virConnectPtr conn,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorCreateSnapshot(priv->mon, snap->def->name);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
cleanup:
if (resume && virDomainObjIsActive(vm) &&
@@ -6434,7 +6441,8 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
priv = vm->privateData;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorLoadSnapshot(priv->mon, snap->def->name);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ rc = -1;
if (rc < 0)
goto endjob;
}
@@ -6557,7 +6565,7 @@ static int qemuDomainSnapshotDiscard(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
/* we continue on even in the face of error */
qemuMonitorDeleteSnapshot(priv->mon, snap->def->name);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ignore_value(qemuDomainObjExitMonitorWithDriver(driver, vm));
}
if (snap == vm->current_snapshot) {
@@ -6770,7 +6778,8 @@ static int qemuDomainMonitorCommand(virDomainPtr domain, const char *cmd,
goto cleanup;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorArbitraryCommand(priv->mon, cmd, result, hmp);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
if (qemuDomainObjEndJob(vm) == 0) {
vm = NULL;
goto cleanup;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index b03f774..1ecac80 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -106,7 +106,8 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
} else {
ret = qemuMonitorEjectMedia(priv->mon, driveAlias, force);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditDisk(vm, origdisk, disk, "update", ret >= 0);
@@ -201,7 +202,8 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
memcpy(&disk->info.addr.pci, &guestAddr, sizeof(guestAddr));
}
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
@@ -277,7 +279,8 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
type,
&controller->info.addr.pci);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
if (ret == 0) {
controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
@@ -433,7 +436,8 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
memcpy(&disk->info.addr.drive, &driveAddr, sizeof(driveAddr));
}
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
@@ -516,7 +520,8 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
} else {
ret = qemuMonitorAddUSBDisk(priv->mon, disk->src);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditDisk(vm, NULL, disk, "attach", ret >= 0);
@@ -632,21 +637,19 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- if (qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name,
- vhostfd, vhostfd_name) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, NULL, net, "attach", false);
- goto cleanup;
- }
+ ret = qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name,
+ vhostfd, vhostfd_name);
} else {
- if (qemuMonitorAddHostNetwork(priv->mon, netstr, tapfd, tapfd_name,
- vhostfd, vhostfd_name) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, NULL, net, "attach", false);
- goto cleanup;
- }
+ ret = qemuMonitorAddHostNetwork(priv->mon, netstr, tapfd, tapfd_name,
+ vhostfd, vhostfd_name);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
+
+ qemuAuditNet(vm, NULL, net, "attach", ret >= 0);
+
+ if (ret < 0)
+ goto cleanup;
VIR_FORCE_CLOSE(tapfd);
VIR_FORCE_CLOSE(vhostfd);
@@ -667,25 +670,23 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, NULL, net, "attach", false);
- goto try_remove;
- }
+ ret = qemuMonitorAddDevice(priv->mon, nicstr);
} else {
- if (qemuMonitorAddPCINetwork(priv->mon, nicstr,
- &guestAddr) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, NULL, net, "attach", false);
- goto try_remove;
+ ret = qemuMonitorAddPCINetwork(priv->mon, nicstr,
+ &guestAddr);
+ if (ret == 0) {
+ net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
+ memcpy(&net->info.addr.pci, &guestAddr, sizeof(guestAddr));
}
- net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
- memcpy(&net->info.addr.pci, &guestAddr, sizeof(guestAddr));
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditNet(vm, NULL, net, "attach", true);
+ if (ret < 0)
+ goto try_remove;
+
ret = 0;
vm->def->nets[vm->def->nnets++] = net;
@@ -723,7 +724,7 @@ try_remove:
if (qemuMonitorRemoveNetdev(priv->mon, netdev_name) < 0)
VIR_WARN("Failed to remove network backend for netdev %s",
netdev_name);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ignore_value(qemuDomainObjExitMonitorWithDriver(driver, vm));
VIR_FREE(netdev_name);
} else {
VIR_WARN0("Unable to remove network backend");
@@ -736,7 +737,7 @@ try_remove:
if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0)
VIR_WARN("Failed to remove network backend for vlan %d, net %s",
vlan, hostnet_name);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ignore_value(qemuDomainObjExitMonitorWithDriver(driver, vm));
VIR_FREE(hostnet_name);
}
goto cleanup;
@@ -795,7 +796,8 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorAddDeviceWithFd(priv->mon, devstr,
configfd, configfd_name);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
} else {
virDomainDevicePCIAddress guestAddr;
@@ -803,7 +805,8 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
ret = qemuMonitorAddPCIHostDevice(priv->mon,
&hostdev->source.subsys.u.pci,
&guestAddr);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
hostdev->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
memcpy(&hostdev->info.addr.pci, &guestAddr, sizeof(guestAddr));
@@ -886,7 +889,8 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
ret = qemuMonitorAddUSBDeviceExact(priv->mon,
hostdev->source.subsys.u.usb.bus,
hostdev->source.subsys.u.usb.device);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditHostdev(vm, hostdev, "attach", ret == 0);
if (ret < 0)
goto error;
@@ -1145,25 +1149,24 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
- qemuDomainObjExitMonitor(vm);
- goto cleanup;
- }
+ ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
} else {
- if (qemuMonitorRemovePCIDevice(priv->mon,
- &detach->info.addr.pci) < 0) {
- qemuDomainObjExitMonitor(vm);
- goto cleanup;
- }
+ ret = qemuMonitorRemovePCIDevice(priv->mon,
+ &detach->info.addr.pci);
}
/* disconnect guest from host device */
- qemuMonitorDriveDel(priv->mon, drivestr);
+ if (ret == 0)
+ qemuMonitorDriveDel(priv->mon, drivestr);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitor(vm) < 0)
+ ret = -1;
qemuAuditDisk(vm, detach, NULL, "detach", ret >= 0);
+ if (ret < 0)
+ goto cleanup;
+
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
VIR_WARN("Unable to release PCI address on %s", dev->data.disk->src);
@@ -1235,18 +1238,20 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
}
qemuDomainObjEnterMonitorWithDriver(driver, vm);
- if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
- qemuDomainObjExitMonitor(vm);
- goto cleanup;
- }
+ ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
/* disconnect guest from host device */
- qemuMonitorDriveDel(priv->mon, drivestr);
+ if (ret == 0)
+ qemuMonitorDriveDel(priv->mon, drivestr);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditDisk(vm, detach, NULL, "detach", ret >= 0);
+ if (ret < 0)
+ goto cleanup;
+
virDomainDiskRemove(vm->def, i);
virDomainDiskDefFree(detach);
@@ -1364,18 +1369,16 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
- qemuDomainObjExitMonitor(vm);
- goto cleanup;
- }
+ ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
} else {
- if (qemuMonitorRemovePCIDevice(priv->mon,
- &detach->info.addr.pci) < 0) {
- qemuDomainObjExitMonitor(vm);
- goto cleanup;
- }
+ ret = qemuMonitorRemovePCIDevice(priv->mon,
+ &detach->info.addr.pci);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
+
+ if (ret < 0)
+ goto cleanup;
if (vm->def->ncontrollers > 1) {
memmove(vm->def->controllers + i,
@@ -1452,37 +1455,30 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
- qemuDomainObjExitMonitor(vm);
- qemuAuditNet(vm, detach, NULL, "detach", false);
- goto cleanup;
- }
+ ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
} else {
- if (qemuMonitorRemovePCIDevice(priv->mon,
- &detach->info.addr.pci) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, detach, NULL, "detach", false);
- goto cleanup;
- }
+ ret = qemuMonitorRemovePCIDevice(priv->mon,
+ &detach->info.addr.pci);
}
+ if (ret < 0)
+ goto exitmonitor;
+
if (qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, detach, NULL, "detach", false);
- goto cleanup;
- }
+ ret = qemuMonitorRemoveNetdev(priv->mon, hostnet_name);
} else {
- if (qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, detach, NULL, "detach", false);
- goto cleanup;
- }
+ ret = qemuMonitorRemoveHostNetwork(priv->mon, vlan, hostnet_name);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- qemuAuditNet(vm, detach, NULL, "detach", true);
+exitmonitor:
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
+
+ qemuAuditNet(vm, detach, NULL, "detach", ret >= 0);
+
+ if (ret < 0)
+ goto cleanup;
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
@@ -1582,7 +1578,8 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
} else {
ret = qemuMonitorRemovePCIDevice(priv->mon, &detach->info.addr.pci);
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditHostdev(vm, detach, "detach", ret == 0);
if (ret < 0)
return -1;
@@ -1681,7 +1678,8 @@ int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorDelDevice(priv->mon, detach->info.alias);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
qemuAuditHostdev(vm, detach, "detach", ret == 0);
if (ret < 0)
return -1;
@@ -1798,7 +1796,8 @@ qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
}
cleanup:
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
return ret;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 43741e1..bdc05c0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -125,7 +125,8 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
VIR_DEBUG0("Cancelling job at client request");
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorMigrateCancel(priv->mon);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ rc = -1;
if (rc < 0) {
VIR_WARN0("Unable to cancel job");
}
@@ -142,7 +143,8 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
VIR_DEBUG("Setting migration downtime to %llums", ms);
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorSetMigrationDowntime(priv->mon, ms);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ rc = -1;
if (rc < 0)
VIR_WARN0("Unable to set migration downtime");
} else if (priv->jobSignals & QEMU_JOB_SIGNAL_MIGRATE_SPEED) {
@@ -153,7 +155,8 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
VIR_DEBUG("Setting migration bandwidth to %luMbs", bandwidth);
qemuDomainObjEnterMonitorWithDriver(driver, vm);
rc = qemuMonitorSetMigrationSpeed(priv->mon, bandwidth);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ rc = -1;
if (rc < 0)
VIR_WARN0("Unable to set migration speed");
}
@@ -173,7 +176,8 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
&memProcessed,
&memRemaining,
&memTotal);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ rc = -1;
if (rc < 0) {
priv->jobInfo.type = VIR_DOMAIN_JOB_FAILED;
@@ -608,11 +612,13 @@ static int doNativeMigrate(struct qemud_driver *driver,
}
qemuDomainObjEnterMonitorWithDriver(driver, vm);
- if (resource > 0 &&
- qemuMonitorSetMigrationSpeed(priv->mon, resource) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- goto cleanup;
- }
+ if (resource > 0)
+ ret = qemuMonitorSetMigrationSpeed(priv->mon, resource);
+ else
+ ret = 0;
+
+ if (ret < 0)
+ goto exitmonitor;
if (flags & VIR_MIGRATE_NON_SHARED_DISK)
background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_DISK;
@@ -620,12 +626,15 @@ static int doNativeMigrate(struct qemud_driver *driver,
if (flags & VIR_MIGRATE_NON_SHARED_INC)
background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
- if (qemuMonitorMigrateToHost(priv->mon, background_flags, uribits->server,
- uribits->port) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ret = qemuMonitorMigrateToHost(priv->mon, background_flags, uribits->server,
+ uribits->port);
+
+exitmonitor:
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
+
+ if (ret < 0)
goto cleanup;
- }
- qemuDomainObjExitMonitorWithDriver(driver, vm);
if (qemuMigrationWaitForCompletion(driver, vm) < 0)
goto cleanup;
@@ -824,7 +833,8 @@ static int doTunnelMigrate(struct qemud_driver *driver,
} else {
internalret = -1;
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ internalret = -1;
if (internalret < 0) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("tunnelled migration monitor command failed"));
@@ -844,17 +854,15 @@ static int doTunnelMigrate(struct qemud_driver *driver,
* rather failed later on. Check the output of "info migrate"
*/
qemuDomainObjEnterMonitorWithDriver(driver, vm);
- if (qemuMonitorGetMigrationStatus(priv->mon,
- &status,
- &transferred,
- &remaining,
- &total) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- goto cancel;
- }
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ retval = qemuMonitorGetMigrationStatus(priv->mon,
+ &status,
+ &transferred,
+ &remaining,
+ &total);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ retval = -1;
- if (status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
+ if (retval < 0 || status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s",_("migrate failed"));
goto cancel;
@@ -875,7 +883,7 @@ cancel:
if (retval != 0 && virDomainObjIsActive(vm)) {
qemuDomainObjEnterMonitorWithDriver(driver, vm);
qemuMonitorMigrateCancel(priv->mon);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ignore_value(qemuDomainObjExitMonitorWithDriver(driver, vm));
}
finish:
@@ -1372,12 +1380,12 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
if (virSetCloseExec(pipeFD[1]) < 0) {
virReportSystemError(errno, "%s",
_("Unable to set cloexec flag"));
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- goto cleanup;
+ rc = -1;
+ goto exitmonitor;
}
if (virCommandRunAsync(cmd, NULL) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
- goto cleanup;
+ rc = -1;
+ goto exitmonitor;
}
rc = qemuMonitorMigrateToFd(priv->mon,
QEMU_MONITOR_MIGRATE_BACKGROUND,
@@ -1391,7 +1399,10 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
args, path, offset);
}
}
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+
+exitmonitor:
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ rc = -1;
if (rc < 0)
goto cleanup;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7295f9e..374de0f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -662,7 +662,8 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorSetCapabilities(priv->mon);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
error:
@@ -1070,7 +1071,8 @@ qemuProcessWaitForMonitor(struct qemud_driver* driver,
priv = vm->privateData;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorGetPtyPaths(priv->mon, paths);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
if (ret == 0)
@@ -1122,11 +1124,12 @@ qemuProcessDetectVcpuPIDs(struct qemud_driver *driver,
/* What follows is now all KVM specific */
qemuDomainObjEnterMonitorWithDriver(driver, vm);
- if ((ncpupids = qemuMonitorGetCPUInfo(priv->mon, &cpupids)) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ncpupids = qemuMonitorGetCPUInfo(priv->mon, &cpupids);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ncpupids = -1;
+
+ if (ncpupids < 0)
return -1;
- }
- qemuDomainObjExitMonitorWithDriver(driver, vm);
/* Treat failure to get VCPU<->PID mapping as non-fatal */
if (ncpupids == 0)
@@ -1322,7 +1325,8 @@ qemuProcessInitPasswords(virConnectPtr conn,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorSetDrivePassphrase(priv->mon, alias, secret);
VIR_FREE(secret);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
if (ret < 0)
goto cleanup;
}
@@ -1713,7 +1717,10 @@ qemuProcessInitPCIAddresses(struct qemud_driver *driver,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
naddrs = qemuMonitorGetAllPCIAddresses(priv->mon,
&addrs);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0) {
+ VIR_FREE(addrs);
+ return -1;
+ }
ret = qemuProcessDetectPCIAddresses(vm, addrs, naddrs);
@@ -1890,7 +1897,8 @@ qemuProcessStartCPUs(struct qemud_driver *driver, virDomainObjPtr vm,
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorStartCPUs(priv->mon, conn);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
if (ret == 0) {
vm->state = VIR_DOMAIN_RUNNING;
}
@@ -1908,7 +1916,8 @@ int qemuProcessStopCPUs(struct qemud_driver *driver, virDomainObjPtr vm)
vm->state = VIR_DOMAIN_PAUSED;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
ret = qemuMonitorStopCPUs(priv->mon);
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
if (ret < 0) {
vm->state = oldState;
}
@@ -2389,11 +2398,12 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG0("Setting initial memory amount");
cur_balloon = vm->def->mem.cur_balloon;
qemuDomainObjEnterMonitorWithDriver(driver, vm);
- if (qemuMonitorSetBalloon(priv->mon, cur_balloon) < 0) {
- qemuDomainObjExitMonitorWithDriver(driver, vm);
+ ret = qemuMonitorSetBalloon(priv->mon, cur_balloon);
+ if (qemuDomainObjExitMonitorWithDriver(driver, vm) < 0)
+ ret = -1;
+
+ if (ret < 0)
goto cleanup;
- }
- qemuDomainObjExitMonitorWithDriver(driver, vm);
if (!start_paused) {
VIR_DEBUG0("Starting domain CPUs");
--
1.7.1
13 years, 8 months
[libvirt] [PATCH] Allow to dynamically set the size of the debug buffer
by Daniel Veillard
This is the part allowing to dynamically resize the debug log
buffer from it's default 64kB size. The buffer is now dynamically
allocated.
It adds a new API virLogSetBufferSize() which resizes the buffer
(possibly dynamically but in that case the existing content is lost -
the complexity wasn't looking like worth it).
If passed a zero size, the buffer is deallocated and we do the small
optimization of not formatting messages which are not output anymore.
On the daemon side, it just adds a new option log_buffer_size to
libvirtd.conf and call virLogSetBufferSize() if needed (minor
pbm of the GET_CONF_* macros is you can't guess if the value was set
or not)
Seems to work fine, I tried to keep the code as simple as needed,
this allowed me to find out that on a quiet daemon startup we emit
half a megabyte of debug log !
The next patch missing now is the update of the documentation for the
log buffer.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 8 months
[libvirt] [PATCH] Write error check conditionals in more compact form for dispatcher
by Daniel P. Berrange
Replace cases of
type = virConnectGetType(conn);
if (type == NULL)
goto cleanup;
With
if (!(type = virConnectGetType(conn)))
goto cleanup;
* daemon/remote.c: Write error checks in compat form
---
daemon/remote.c | 795 +++++++++++++++++++------------------------------------
1 files changed, 278 insertions(+), 517 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 247a226..66df9f7 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -473,9 +473,7 @@ remoteDispatchSupportsFeature(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->supported = virDrvSupportsFeature(conn, args->feature);
-
- if (ret->supported < 0)
+ if ((ret->supported = virDrvSupportsFeature(conn, args->feature)) < 0)
goto cleanup;
rv = 0;
@@ -502,15 +500,13 @@ remoteDispatchGetType(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- type = virConnectGetType(conn);
- if (type == NULL)
+ if (!(type = virConnectGetType(conn)))
goto cleanup;
/* We have to strdup because remoteDispatchClientRequest will
* free this string after it's been serialised.
*/
- ret->type = strdup(type);
- if (!ret->type) {
+ if (!(ret->type = strdup(type))) {
virReportOOMError();
goto cleanup;
}
@@ -598,8 +594,7 @@ remoteDispatchGetHostname(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- hostname = virConnectGetHostname(conn);
- if (hostname == NULL)
+ if (!(hostname = virConnectGetHostname(conn)))
goto cleanup;
ret->hostname = hostname;
@@ -628,8 +623,7 @@ remoteDispatchGetUri(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- uri = virConnectGetURI(conn);
- if (uri == NULL)
+ if (!(uri = virConnectGetURI(conn)))
goto cleanup;
ret->uri = uri;
@@ -660,8 +654,7 @@ remoteDispatchGetSysinfo(struct qemud_server *server ATTRIBUTE_UNUSED,
}
flags = args->flags;
- sysinfo = virConnectGetSysinfo(conn, flags);
- if (sysinfo == NULL)
+ if (!(sysinfo = virConnectGetSysinfo(conn, flags)))
goto cleanup;
ret->sysinfo = sysinfo;
@@ -691,8 +684,7 @@ remoteDispatchGetMaxVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
}
type = args->type ? *args->type : NULL;
- ret->max_vcpus = virConnectGetMaxVcpus(conn, type);
- if (ret->max_vcpus < 0)
+ if ((ret->max_vcpus = virConnectGetMaxVcpus(conn, type)) < 0)
goto cleanup;
rv = 0;
@@ -757,8 +749,7 @@ remoteDispatchGetCapabilities(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- caps = virConnectGetCapabilities(conn);
- if (caps == NULL)
+ if (!(caps = virConnectGetCapabilities(conn)))
goto cleanup;
ret->capabilities = caps;
@@ -779,7 +770,7 @@ remoteDispatchNodeGetCellsFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSE
remote_node_get_cells_free_memory_args *args,
remote_node_get_cells_free_memory_ret *ret)
{
- int err;
+ int len;
int rv = -1;
if (!conn) {
@@ -799,13 +790,13 @@ remoteDispatchNodeGetCellsFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- err = virNodeGetCellsFreeMemory(conn,
+ len = virNodeGetCellsFreeMemory(conn,
(unsigned long long *)ret->freeMems.freeMems_val,
args->startCell,
args->maxCells);
- if (err <= 0)
+ if (len <= 0)
goto cleanup;
- ret->freeMems.freeMems_len = err;
+ ret->freeMems.freeMems_len = len;
rv = 0;
@@ -835,8 +826,7 @@ remoteDispatchNodeGetFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- freeMem = virNodeGetFreeMemory(conn);
- if (freeMem == 0)
+ if ((freeMem = virNodeGetFreeMemory(conn)) == 0)
goto cleanup;
ret->freeMem = freeMem;
rv = 0;
@@ -867,12 +857,10 @@ remoteDispatchDomainGetSchedulerType(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- type = virDomainGetSchedulerType(dom, &nparams);
- if (type == NULL)
+ if (!(type = virDomainGetSchedulerType(dom, &nparams)))
goto cleanup;
ret->type = type;
@@ -898,7 +886,7 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server ATTRIBUTE
{
virDomainPtr dom = NULL;
virSchedParameterPtr params;
- int i, r, nparams;
+ int i, nparams;
int rv = -1;
if (!conn) {
@@ -917,12 +905,10 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server ATTRIBUTE
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- r = virDomainGetSchedulerParameters(dom, params, &nparams);
- if (r < 0)
+ if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0)
goto cleanup;
/* Serialise the scheduler parameters. */
@@ -984,7 +970,7 @@ remoteDispatchDomainSetSchedulerParameters(struct qemud_server *server ATTRIBUTE
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
- int i, r, nparams;
+ int i, nparams;
virSchedParameterPtr params;
int rv = -1;
@@ -1028,12 +1014,10 @@ remoteDispatchDomainSetSchedulerParameters(struct qemud_server *server ATTRIBUTE
}
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- r = virDomainSetSchedulerParameters(dom, params, nparams);
- if (r < 0)
+ if (virDomainSetSchedulerParameters(dom, params, nparams) < 0)
goto cleanup;
rv = 0;
@@ -1066,8 +1050,7 @@ remoteDispatchDomainBlockStats(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
path = args->path;
@@ -1109,8 +1092,7 @@ remoteDispatchDomainInterfaceStats(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
path = args->path;
@@ -1161,8 +1143,7 @@ remoteDispatchDomainMemoryStats(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
/* Allocate stats array for making dispatch call */
@@ -1219,8 +1200,7 @@ remoteDispatchDomainBlockPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
path = args->path;
offset = args->offset;
@@ -1275,8 +1255,7 @@ remoteDispatchDomainMemoryPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
offset = args->offset;
size = args->size;
@@ -1329,8 +1308,7 @@ remoteDispatchDomainAttachDevice(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAttachDevice(dom, args->xml) < 0)
@@ -1363,8 +1341,7 @@ remoteDispatchDomainAttachDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) < 0)
@@ -1397,8 +1374,7 @@ remoteDispatchDomainUpdateDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) < 0)
@@ -1431,8 +1407,7 @@ remoteDispatchDomainCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCreate(dom) < 0)
@@ -1460,8 +1435,7 @@ remoteDispatchDomainCreateWithFlags(struct qemud_server *server ATTRIBUTE_UNUSED
int rv = -1;
virDomainPtr dom = NULL;
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCreateWithFlags(dom, args->flags) < 0)
@@ -1496,8 +1470,7 @@ remoteDispatchDomainCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = virDomainCreateXML(conn, args->xml_desc, args->flags);
- if (dom == NULL)
+ if (!(dom = virDomainCreateXML(conn, args->xml_desc, args->flags)))
goto cleanup;
make_nonnull_domain(&ret->dom, dom);
@@ -1529,8 +1502,7 @@ remoteDispatchDomainDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = virDomainDefineXML(conn, args->xml);
- if (dom == NULL)
+ if (!(dom = virDomainDefineXML(conn, args->xml)))
goto cleanup;
make_nonnull_domain(&ret->dom, dom);
@@ -1562,8 +1534,7 @@ remoteDispatchDomainDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDestroy(dom) < 0)
@@ -1596,8 +1567,7 @@ remoteDispatchDomainDetachDevice(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDetachDevice(dom, args->xml) < 0)
@@ -1630,8 +1600,7 @@ remoteDispatchDomainDetachDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) < 0)
@@ -1664,13 +1633,11 @@ remoteDispatchDomainDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virDomainGetXMLDesc(dom, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virDomainGetXMLDesc(dom, args->flags)))
goto cleanup;
rv = 0;
@@ -1700,12 +1667,12 @@ remoteDispatchDomainXmlFromNative(struct qemud_server *server ATTRIBUTE_UNUSED,
}
/* remoteDispatchClientRequest will free this. */
- ret->domainXml = virConnectDomainXMLFromNative(conn,
- args->nativeFormat,
- args->nativeConfig,
- args->flags);
- if (!ret->domainXml)
+ if (!(ret->domainXml = virConnectDomainXMLFromNative(conn,
+ args->nativeFormat,
+ args->nativeConfig,
+ args->flags)))
goto cleanup;
+
rv = 0;
cleanup:
@@ -1731,12 +1698,12 @@ remoteDispatchDomainXmlToNative(struct qemud_server *server ATTRIBUTE_UNUSED,
}
/* remoteDispatchClientRequest will free this. */
- ret->nativeConfig = virConnectDomainXMLToNative(conn,
- args->nativeFormat,
- args->domainXml,
- args->flags);
- if (!ret->nativeConfig)
+ if (!(ret->nativeConfig = virConnectDomainXMLToNative(conn,
+ args->nativeFormat,
+ args->domainXml,
+ args->flags)))
goto cleanup;
+
rv = 0;
cleanup:
@@ -1763,8 +1730,7 @@ remoteDispatchDomainGetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetAutostart(dom, &ret->autostart) < 0)
@@ -1798,8 +1764,7 @@ remoteDispatchDomainGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetInfo(dom, &info) < 0)
@@ -1838,12 +1803,10 @@ remoteDispatchDomainGetMaxMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->memory = virDomainGetMaxMemory(dom);
- if (ret->memory == 0)
+ if ((ret->memory = virDomainGetMaxMemory(dom)) == 0)
goto cleanup;
rv = 0;
@@ -1873,12 +1836,10 @@ remoteDispatchDomainGetMaxVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->num = virDomainGetMaxVcpus(dom);
- if (ret->num < 0)
+ if ((ret->num = virDomainGetMaxVcpus(dom)) < 0)
goto cleanup;
rv = 0;
@@ -1909,8 +1870,7 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (VIR_ALLOC(seclabel) < 0) {
@@ -2000,14 +1960,13 @@ remoteDispatchDomainGetOsType(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
/* remoteDispatchClientRequest will free this */
- ret->type = virDomainGetOSType(dom);
- if (ret->type == NULL)
+ if (!(ret->type = virDomainGetOSType(dom)))
goto cleanup;
+
rv = 0;
cleanup:
@@ -2038,8 +1997,7 @@ remoteDispatchDomainGetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
@@ -2059,10 +2017,9 @@ remoteDispatchDomainGetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
VIR_ALLOC_N(cpumaps, args->maxinfo * args->maplen) < 0)
goto no_memory;
- info_len = virDomainGetVcpus(dom,
- info, args->maxinfo,
- cpumaps, args->maplen);
- if (info_len < 0)
+ if ((info_len = virDomainGetVcpus(dom,
+ info, args->maxinfo,
+ cpumaps, args->maplen)) < 0)
goto cleanup;
/* Allocate the return buffer for info. */
@@ -2120,12 +2077,10 @@ remoteDispatchDomainGetVcpusFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->num = virDomainGetVcpusFlags(dom, args->flags);
- if (ret->num < 0)
+ if ((ret->num = virDomainGetVcpusFlags(dom, args->flags)) < 0)
goto cleanup;
rv = 0;
@@ -2147,7 +2102,6 @@ remoteDispatchDomainMigratePrepare(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_migrate_prepare_args *args,
remote_domain_migrate_prepare_ret *ret)
{
- int r;
char *cookie = NULL;
int cookielen = 0;
char *uri_in;
@@ -2169,10 +2123,9 @@ remoteDispatchDomainMigratePrepare(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- r = virDomainMigratePrepare(conn, &cookie, &cookielen,
+ if (virDomainMigratePrepare(conn, &cookie, &cookielen,
uri_in, uri_out,
- args->flags, dname, args->resource);
- if (r < 0)
+ args->flags, dname, args->resource) < 0)
goto cleanup;
/* remoteDispatchClientRequest will free cookie, uri_out and
@@ -2205,7 +2158,6 @@ remoteDispatchDomainMigratePerform(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_migrate_perform_args *args,
void *ret ATTRIBUTE_UNUSED)
{
- int r;
virDomainPtr dom = NULL;
char *dname;
int rv = -1;
@@ -2215,18 +2167,16 @@ remoteDispatchDomainMigratePerform(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
dname = args->dname == NULL ? NULL : *args->dname;
- r = virDomainMigratePerform(dom,
+ if (virDomainMigratePerform(dom,
args->cookie.cookie_val,
args->cookie.cookie_len,
args->uri,
- args->flags, dname, args->resource);
- if (r < 0)
+ args->flags, dname, args->resource) < 0)
goto cleanup;
rv = 0;
@@ -2256,12 +2206,11 @@ remoteDispatchDomainMigrateFinish(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ddom = virDomainMigrateFinish(conn, args->dname,
- args->cookie.cookie_val,
- args->cookie.cookie_len,
- args->uri,
- args->flags);
- if (ddom == NULL)
+ if (!(ddom = virDomainMigrateFinish(conn, args->dname,
+ args->cookie.cookie_val,
+ args->cookie.cookie_len,
+ args->uri,
+ args->flags)))
goto cleanup;
make_nonnull_domain(&ret->ddom, ddom);
@@ -2284,7 +2233,6 @@ remoteDispatchDomainMigratePrepare2(struct qemud_server *server ATTRIBUTE_UNUSED
remote_domain_migrate_prepare2_args *args,
remote_domain_migrate_prepare2_ret *ret)
{
- int r;
char *cookie = NULL;
int cookielen = 0;
char *uri_in;
@@ -2306,11 +2254,10 @@ remoteDispatchDomainMigratePrepare2(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- r = virDomainMigratePrepare2(conn, &cookie, &cookielen,
+ if (virDomainMigratePrepare2(conn, &cookie, &cookielen,
uri_in, uri_out,
args->flags, dname, args->resource,
- args->dom_xml);
- if (r < 0)
+ args->dom_xml) < 0)
goto cleanup;
/* remoteDispatchClientRequest will free cookie, uri_out and
@@ -2345,13 +2292,12 @@ remoteDispatchDomainMigrateFinish2(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ddom = virDomainMigrateFinish2(conn, args->dname,
- args->cookie.cookie_val,
- args->cookie.cookie_len,
- args->uri,
- args->flags,
- args->retcode);
- if (ddom == NULL)
+ if (!(ddom = virDomainMigrateFinish2(conn, args->dname,
+ args->cookie.cookie_val,
+ args->cookie.cookie_len,
+ args->uri,
+ args->flags,
+ args->retcode)))
goto cleanup;
make_nonnull_domain(&ret->ddom, ddom);
@@ -2375,7 +2321,6 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_U
remote_domain_migrate_prepare_tunnel_args *args,
void *ret ATTRIBUTE_UNUSED)
{
- int r;
char *dname;
struct qemud_client_stream *stream = NULL;
int rv = -1;
@@ -2387,16 +2332,14 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_U
dname = args->dname == NULL ? NULL : *args->dname;
- stream = remoteCreateClientStream(conn, hdr);
- if (!stream) {
+ if (!(stream = remoteCreateClientStream(conn, hdr))) {
virReportOOMError();
goto cleanup;
}
- r = virDomainMigratePrepareTunnel(conn, stream->st,
+ if (virDomainMigratePrepareTunnel(conn, stream->st,
args->flags, dname, args->resource,
- args->dom_xml);
- if (r < 0)
+ args->dom_xml) < 0)
goto cleanup;
if (remoteAddClientStream(client, stream, 0) < 0)
@@ -2477,8 +2420,7 @@ remoteDispatchDomainLookupById(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = virDomainLookupByID(conn, args->id);
- if (dom == NULL)
+ if (!(dom = virDomainLookupByID(conn, args->id)))
goto cleanup;
make_nonnull_domain(&ret->dom, dom);
@@ -2510,8 +2452,7 @@ remoteDispatchDomainLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = virDomainLookupByName(conn, args->name);
- if (dom == NULL)
+ if (!(dom = virDomainLookupByName(conn, args->name)))
goto cleanup;
make_nonnull_domain(&ret->dom, dom);
@@ -2543,8 +2484,7 @@ remoteDispatchDomainLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = virDomainLookupByUUID(conn, (unsigned char *) args->uuid);
- if (dom == NULL)
+ if (!(dom = virDomainLookupByUUID(conn, (unsigned char *) args->uuid)))
goto cleanup;
make_nonnull_domain(&ret->dom, dom);
@@ -2575,8 +2515,7 @@ remoteDispatchNumOfDefinedDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfDefinedDomains(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfDefinedDomains(conn)) < 0)
goto cleanup;
rv = 0;
@@ -2604,8 +2543,7 @@ remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) {
@@ -2613,10 +2551,9 @@ remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- rv = virDomainPinVcpu(dom, args->vcpu,
- (unsigned char *) args->cpumap.cpumap_val,
- args->cpumap.cpumap_len);
- if (rv < 0)
+ if (virDomainPinVcpu(dom, args->vcpu,
+ (unsigned char *) args->cpumap.cpumap_val,
+ args->cpumap.cpumap_len) < 0)
goto cleanup;
rv = 0;
@@ -2646,8 +2583,7 @@ remoteDispatchDomainReboot(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainReboot(dom, args->flags) < 0)
@@ -2707,8 +2643,7 @@ remoteDispatchDomainResume(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainResume(dom) < 0)
@@ -2741,8 +2676,7 @@ remoteDispatchDomainSave(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSave(dom, args->to) < 0)
@@ -2775,8 +2709,7 @@ remoteDispatchDomainCoreDump(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCoreDump(dom, args->to, args->flags) < 0)
@@ -2809,8 +2742,7 @@ remoteDispatchDomainSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetAutostart(dom, args->autostart) < 0)
@@ -2843,8 +2775,7 @@ remoteDispatchDomainSetMaxMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMaxMemory(dom, args->memory) < 0)
@@ -2877,8 +2808,7 @@ remoteDispatchDomainSetMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMemory(dom, args->memory) < 0)
@@ -2911,8 +2841,7 @@ remoteDispatchDomainSetMemoryFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMemoryFlags(dom, args->memory, args->flags) < 0)
@@ -2941,7 +2870,7 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
* args, void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
- int i, r, nparams;
+ int i, nparams;
virMemoryParameterPtr params;
unsigned int flags;
int rv = -1;
@@ -3007,12 +2936,10 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
}
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- r = virDomainSetMemoryParameters(dom, params, nparams, flags);
- if (r < 0)
+ if (virDomainSetMemoryParameters(dom, params, nparams, flags) < 0)
goto cleanup;
rv = 0;
@@ -3042,7 +2969,7 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
{
virDomainPtr dom = NULL;
virMemoryParameterPtr params;
- int i, r, nparams;
+ int i, nparams;
unsigned int flags;
int rv = -1;
@@ -3063,13 +2990,12 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- r = virDomainGetMemoryParameters(dom, params, &nparams, flags);
- if (r < 0)
+ if (virDomainGetMemoryParameters(dom, params, &nparams, flags) < 0)
goto cleanup;
+
/* In this case, we need to send back the number of parameters
* supported
*/
@@ -3158,7 +3084,7 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server
* args, void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
- int i, r, nparams;
+ int i, nparams;
virBlkioParameterPtr params;
unsigned int flags;
int rv = -1;
@@ -3224,12 +3150,10 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server
}
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- r = virDomainSetBlkioParameters(dom, params, nparams, flags);
- if (r < 0)
+ if (virDomainSetBlkioParameters(dom, params, nparams, flags) < 0)
goto cleanup;
rv = 0;
@@ -3259,7 +3183,7 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server
{
virDomainPtr dom = NULL;
virBlkioParameterPtr params;
- int i, r, nparams;
+ int i, nparams;
unsigned int flags;
int rv = -1;
@@ -3280,13 +3204,12 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- r = virDomainGetBlkioParameters(dom, params, &nparams, flags);
- if (r < 0)
+ if (virDomainGetBlkioParameters(dom, params, &nparams, flags) < 0)
goto cleanup;
+
/* In this case, we need to send back the number of parameters
* supported
*/
@@ -3381,8 +3304,7 @@ remoteDispatchDomainSetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetVcpus(dom, args->nvcpus) < 0)
@@ -3415,8 +3337,7 @@ remoteDispatchDomainSetVcpusFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) < 0)
@@ -3449,8 +3370,7 @@ remoteDispatchDomainShutdown(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainShutdown(dom) < 0)
@@ -3483,8 +3403,7 @@ remoteDispatchDomainSuspend(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSuspend(dom) < 0)
@@ -3517,8 +3436,7 @@ remoteDispatchDomainUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainUndefine(dom) < 0)
@@ -3641,8 +3559,7 @@ remoteDispatchDomainManagedSave(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainManagedSave(dom, args->flags) < 0)
@@ -3675,12 +3592,10 @@ remoteDispatchDomainHasManagedSaveImage(struct qemud_server *server ATTRIBUTE_UN
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->ret = virDomainHasManagedSaveImage(dom, args->flags);
- if (ret->ret < 0)
+ if ((ret->ret = virDomainHasManagedSaveImage(dom, args->flags)) < 0)
goto cleanup;
rv = 0;
@@ -3710,8 +3625,7 @@ remoteDispatchDomainManagedSaveRemove(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainManagedSaveRemove(dom, args->flags) < 0)
@@ -3789,8 +3703,7 @@ remoteDispatchNetworkCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkCreate(net) < 0)
@@ -3823,8 +3736,7 @@ remoteDispatchNetworkCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = virNetworkCreateXML(conn, args->xml);
- if (net == NULL)
+ if (!(net = virNetworkCreateXML(conn, args->xml)))
goto cleanup;
make_nonnull_network(&ret->net, net);
@@ -3856,8 +3768,7 @@ remoteDispatchNetworkDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = virNetworkDefineXML(conn, args->xml);
- if (net == NULL)
+ if (!(net = virNetworkDefineXML(conn, args->xml)))
goto cleanup;
make_nonnull_network(&ret->net, net);
@@ -3889,8 +3800,7 @@ remoteDispatchNetworkDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkDestroy(net) < 0)
@@ -3923,13 +3833,11 @@ remoteDispatchNetworkDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virNetworkGetXMLDesc(net, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virNetworkGetXMLDesc(net, args->flags)))
goto cleanup;
rv = 0;
@@ -3959,8 +3867,7 @@ remoteDispatchNetworkGetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkGetAutostart(net, &ret->autostart) < 0)
@@ -3993,13 +3900,11 @@ remoteDispatchNetworkGetBridgeName(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->name = virNetworkGetBridgeName(net);
- if (!ret->name)
+ if (!(ret->name = virNetworkGetBridgeName(net)))
goto cleanup;
rv = 0;
@@ -4029,8 +3934,7 @@ remoteDispatchNetworkLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = virNetworkLookupByName(conn, args->name);
- if (net == NULL)
+ if (!(net = virNetworkLookupByName(conn, args->name)))
goto cleanup;
make_nonnull_network(&ret->net, net);
@@ -4062,8 +3966,7 @@ remoteDispatchNetworkLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid);
- if (net == NULL)
+ if (!(net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid)))
goto cleanup;
make_nonnull_network(&ret->net, net);
@@ -4095,8 +3998,7 @@ remoteDispatchNetworkSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkSetAutostart(net, args->autostart) < 0)
@@ -4129,8 +4031,7 @@ remoteDispatchNetworkUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- net = get_nonnull_network(conn, args->net);
- if (net == NULL)
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkUndefine(net) < 0)
@@ -4192,8 +4093,7 @@ remoteDispatchNumOfDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfDomains(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfDomains(conn)) < 0)
goto cleanup;
rv = 0;
@@ -4220,8 +4120,7 @@ remoteDispatchNumOfNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfNetworks(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfNetworks(conn)) < 0)
goto cleanup;
rv = 0;
@@ -4250,8 +4149,7 @@ remoteDispatchNumOfInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfInterfaces(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfInterfaces(conn)) < 0)
goto cleanup;
rv = 0;
@@ -4399,8 +4297,7 @@ remoteDispatchInterfaceLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- iface = virInterfaceLookupByName(conn, args->name);
- if (iface == NULL)
+ if (!(iface = virInterfaceLookupByName(conn, args->name)))
goto cleanup;
make_nonnull_interface(&ret->iface, iface);
@@ -4432,8 +4329,7 @@ remoteDispatchInterfaceLookupByMacString(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- iface = virInterfaceLookupByMACString(conn, args->mac);
- if (iface == NULL)
+ if (!(iface = virInterfaceLookupByMACString(conn, args->mac)))
goto cleanup;
make_nonnull_interface(&ret->iface, iface);
@@ -4465,13 +4361,11 @@ remoteDispatchInterfaceGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL)
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virInterfaceGetXMLDesc(iface, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virInterfaceGetXMLDesc(iface, args->flags)))
goto cleanup;
rv = 0;
@@ -4501,8 +4395,7 @@ remoteDispatchInterfaceDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- iface = virInterfaceDefineXML(conn, args->xml, args->flags);
- if (iface == NULL)
+ if (!(iface = virInterfaceDefineXML(conn, args->xml, args->flags)))
goto cleanup;
make_nonnull_interface(&ret->iface, iface);
@@ -4534,8 +4427,7 @@ remoteDispatchInterfaceUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL)
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceUndefine(iface) < 0)
@@ -4568,8 +4460,7 @@ remoteDispatchInterfaceCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL)
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceCreate(iface, args->flags) < 0)
@@ -4602,8 +4493,7 @@ remoteDispatchInterfaceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL)
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceDestroy(iface, args->flags) < 0)
@@ -5528,12 +5418,11 @@ remoteDispatchFindStoragePoolSources(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- ret->xml =
- virConnectFindStoragePoolSources(conn,
- args->type,
- args->srcSpec ? *args->srcSpec : NULL,
- args->flags);
- if (ret->xml == NULL)
+ if (!(ret->xml =
+ virConnectFindStoragePoolSources(conn,
+ args->type,
+ args->srcSpec ? *args->srcSpec : NULL,
+ args->flags)))
goto cleanup;
rv = 0;
@@ -5562,8 +5451,7 @@ remoteDispatchStoragePoolCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolCreate(pool, args->flags) < 0)
@@ -5596,8 +5484,7 @@ remoteDispatchStoragePoolCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = virStoragePoolCreateXML(conn, args->xml, args->flags);
- if (pool == NULL)
+ if (!(pool = virStoragePoolCreateXML(conn, args->xml, args->flags)))
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
@@ -5629,8 +5516,7 @@ remoteDispatchStoragePoolDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = virStoragePoolDefineXML(conn, args->xml, args->flags);
- if (pool == NULL)
+ if (!(pool = virStoragePoolDefineXML(conn, args->xml, args->flags)))
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
@@ -5662,8 +5548,7 @@ remoteDispatchStoragePoolBuild(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolBuild(pool, args->flags) < 0)
@@ -5697,8 +5582,7 @@ remoteDispatchStoragePoolDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolDestroy(pool) < 0)
@@ -5731,8 +5615,7 @@ remoteDispatchStoragePoolDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolDelete(pool, args->flags) < 0)
@@ -5765,8 +5648,7 @@ remoteDispatchStoragePoolRefresh(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolRefresh(pool, args->flags) < 0)
@@ -5800,8 +5682,7 @@ remoteDispatchStoragePoolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolGetInfo(pool, &info) < 0)
@@ -5839,13 +5720,11 @@ remoteDispatchStoragePoolDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virStoragePoolGetXMLDesc(pool, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virStoragePoolGetXMLDesc(pool, args->flags)))
goto cleanup;
rv = 0;
@@ -5875,8 +5754,7 @@ remoteDispatchStoragePoolGetAutostart(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolGetAutostart(pool, &ret->autostart) < 0)
@@ -5910,8 +5788,7 @@ remoteDispatchStoragePoolLookupByName(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- pool = virStoragePoolLookupByName(conn, args->name);
- if (pool == NULL)
+ if (!(pool = virStoragePoolLookupByName(conn, args->name)))
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
@@ -5943,8 +5820,7 @@ remoteDispatchStoragePoolLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- pool = virStoragePoolLookupByUUID(conn, (unsigned char *) args->uuid);
- if (pool == NULL)
+ if (!(pool = virStoragePoolLookupByUUID(conn, (unsigned char *) args->uuid)))
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
@@ -5977,12 +5853,10 @@ remoteDispatchStoragePoolLookupByVolume(struct qemud_server *server ATTRIBUTE_UN
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
- pool = virStoragePoolLookupByVolume(vol);
- if (pool == NULL)
+ if (!(pool = virStoragePoolLookupByVolume(vol)))
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
@@ -6016,8 +5890,7 @@ remoteDispatchStoragePoolSetAutostart(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolSetAutostart(pool, args->autostart) < 0)
@@ -6050,8 +5923,7 @@ remoteDispatchStoragePoolUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolUndefine(pool) < 0)
@@ -6083,8 +5955,7 @@ remoteDispatchNumOfStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfStoragePools(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfStoragePools(conn)) < 0)
goto cleanup;
rv = 0;
@@ -6111,8 +5982,7 @@ remoteDispatchNumOfDefinedStoragePools(struct qemud_server *server ATTRIBUTE_UNU
goto cleanup;
}
- ret->num = virConnectNumOfDefinedStoragePools(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfDefinedStoragePools(conn)) < 0)
goto cleanup;
rv = 0;
@@ -6147,8 +6017,7 @@ remoteDispatchStoragePoolListVolumes(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
/* Allocate return buffer. */
@@ -6193,12 +6062,10 @@ remoteDispatchStoragePoolNumOfVolumes(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
- ret->num = virStoragePoolNumOfVolumes(pool);
- if (ret->num < 0)
+ if ((ret->num = virStoragePoolNumOfVolumes(pool)) < 0)
goto cleanup;
rv = 0;
@@ -6236,12 +6103,10 @@ remoteDispatchStorageVolCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
- vol = virStorageVolCreateXML(pool, args->xml, args->flags);
- if (vol == NULL)
+ if (!(vol = virStorageVolCreateXML(pool, args->xml, args->flags)))
goto cleanup;
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6276,17 +6141,14 @@ remoteDispatchStorageVolCreateXmlFrom(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
- clonevol = get_nonnull_storage_vol(conn, args->clonevol);
- if (clonevol == NULL)
+ if (!(clonevol = get_nonnull_storage_vol(conn, args->clonevol)))
goto cleanup;
- newvol = virStorageVolCreateXMLFrom(pool, args->xml, clonevol,
- args->flags);
- if (newvol == NULL)
+ if (!(newvol = virStorageVolCreateXMLFrom(pool, args->xml, clonevol,
+ args->flags)))
goto cleanup;
make_nonnull_storage_vol(&ret->vol, newvol);
@@ -6321,8 +6183,7 @@ remoteDispatchStorageVolDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolDelete(vol, args->flags) < 0)
@@ -6355,8 +6216,7 @@ remoteDispatchStorageVolWipe(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolWipe(vol, args->flags) < 0)
@@ -6390,8 +6250,7 @@ remoteDispatchStorageVolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolGetInfo(vol, &info) < 0)
@@ -6428,13 +6287,11 @@ remoteDispatchStorageVolDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virStorageVolGetXMLDesc(vol, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virStorageVolGetXMLDesc(vol, args->flags)))
goto cleanup;
rv = 0;
@@ -6465,13 +6322,11 @@ remoteDispatchStorageVolGetPath(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->name = virStorageVolGetPath(vol);
- if (!ret->name)
+ if (!(ret->name = virStorageVolGetPath(vol)))
goto cleanup;
rv = 0;
@@ -6503,12 +6358,10 @@ remoteDispatchStorageVolLookupByName(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
- vol = virStorageVolLookupByName(pool, args->name);
- if (vol == NULL)
+ if (!(vol = virStorageVolLookupByName(pool, args->name)))
goto cleanup;
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6542,8 +6395,7 @@ remoteDispatchStorageVolLookupByKey(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- vol = virStorageVolLookupByKey(conn, args->key);
- if (vol == NULL)
+ if (!(vol = virStorageVolLookupByKey(conn, args->key)))
goto cleanup;
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6576,8 +6428,7 @@ remoteDispatchStorageVolLookupByPath(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- vol = virStorageVolLookupByPath(conn, args->path);
- if (vol == NULL)
+ if (!(vol = virStorageVolLookupByPath(conn, args->path)))
goto cleanup;
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6613,10 +6464,9 @@ remoteDispatchNodeNumOfDevices(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virNodeNumOfDevices(conn,
- args->cap ? *args->cap : NULL,
- args->flags);
- if (ret->num < 0)
+ if ((ret->num = virNodeNumOfDevices(conn,
+ args->cap ? *args->cap : NULL,
+ args->flags)) < 0)
goto cleanup;
rv = 0;
@@ -6692,8 +6542,7 @@ remoteDispatchNodeDeviceLookupByName(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
make_nonnull_node_device(&ret->dev, dev);
@@ -6726,13 +6575,11 @@ remoteDispatchNodeDeviceDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virNodeDeviceGetXMLDesc(dev, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virNodeDeviceGetXMLDesc(dev, args->flags)))
goto cleanup;
rv = 0;
@@ -6764,8 +6611,7 @@ remoteDispatchNodeDeviceGetParent(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
parent = virNodeDeviceGetParent(dev);
@@ -6815,12 +6661,10 @@ remoteDispatchNodeDeviceNumOfCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
- ret->num = virNodeDeviceNumOfCaps(dev);
- if (ret->num < 0)
+ if ((ret->num = virNodeDeviceNumOfCaps(dev)) < 0)
goto cleanup;
rv = 0;
@@ -6852,8 +6696,7 @@ remoteDispatchNodeDeviceListCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
@@ -6904,8 +6747,7 @@ remoteDispatchNodeDeviceDettach(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceDettach(dev) < 0)
@@ -6939,8 +6781,7 @@ remoteDispatchNodeDeviceReAttach(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceReAttach(dev) < 0)
@@ -6974,8 +6815,7 @@ remoteDispatchNodeDeviceReset(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceReset(dev) < 0)
@@ -7009,8 +6849,7 @@ remoteDispatchNodeDeviceCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags)))
goto cleanup;
make_nonnull_node_device(&ret->dev, dev);
@@ -7043,8 +6882,7 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL)
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceDestroy(dev) < 0)
@@ -7077,12 +6915,10 @@ static int remoteDispatchStorageVolUpload(struct qemud_server *server ATTRIBUTE_
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
- stream = remoteCreateClientStream(conn, hdr);
- if (!stream)
+ if (!(stream = remoteCreateClientStream(conn, hdr)))
goto cleanup;
if (virStorageVolUpload(vol, stream->st,
@@ -7124,12 +6960,10 @@ static int remoteDispatchStorageVolDownload(struct qemud_server *server ATTRIBUT
goto cleanup;
}
- vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL)
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
- stream = remoteCreateClientStream(conn, hdr);
- if (!stream)
+ if (!(stream = remoteCreateClientStream(conn, hdr)))
goto cleanup;
if (virStorageVolDownload(vol, stream->st,
@@ -7311,8 +7145,7 @@ remoteDispatchNumOfSecrets(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfSecrets(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfSecrets(conn)) < 0)
goto cleanup;
rv = 0;
@@ -7384,8 +7217,7 @@ remoteDispatchSecretDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = virSecretDefineXML(conn, args->xml, args->flags);
- if (secret == NULL)
+ if (!(secret = virSecretDefineXML(conn, args->xml, args->flags)))
goto cleanup;
make_nonnull_secret(&ret->secret, secret);
@@ -7418,12 +7250,10 @@ remoteDispatchSecretGetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL)
+ if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
- value = virSecretGetValue(secret, &value_size, args->flags);
- if (value == NULL)
+ if (!(value = virSecretGetValue(secret, &value_size, args->flags)))
goto cleanup;
ret->value.value_len = value_size;
@@ -7456,11 +7286,9 @@ remoteDispatchSecretGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL)
+ if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
- ret->xml = virSecretGetXMLDesc(secret, args->flags);
- if (ret->xml == NULL)
+ if (!(ret->xml = virSecretGetXMLDesc(secret, args->flags)))
goto cleanup;
rv = 0;
@@ -7490,8 +7318,7 @@ remoteDispatchSecretLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = virSecretLookupByUUID(conn, (unsigned char *)args->uuid);
- if (secret == NULL)
+ if (!(secret = virSecretLookupByUUID(conn, (unsigned char *)args->uuid)))
goto cleanup;
make_nonnull_secret(&ret->secret, secret);
@@ -7523,8 +7350,7 @@ remoteDispatchSecretSetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL)
+ if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (virSecretSetValue(secret, (const unsigned char *)args->value.value_val,
args->value.value_len, args->flags) < 0)
@@ -7557,8 +7383,7 @@ remoteDispatchSecretUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL)
+ if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (virSecretUndefine(secret) < 0)
goto cleanup;
@@ -7590,8 +7415,7 @@ remoteDispatchSecretLookupByUsage(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- secret = virSecretLookupByUsage(conn, args->usageType, args->usageID);
- if (secret == NULL)
+ if (!(secret = virSecretLookupByUsage(conn, args->usageType, args->usageID)))
goto cleanup;
make_nonnull_secret(&ret->secret, secret);
@@ -7623,13 +7447,10 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->dom);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->active = virDomainIsActive(domain);
-
- if (ret->active < 0)
+ if ((ret->active = virDomainIsActive(domain)) < 0)
goto cleanup;
rv = 0;
@@ -7658,13 +7479,10 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->dom);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->persistent = virDomainIsPersistent(domain);
-
- if (ret->persistent < 0)
+ if ((ret->persistent = virDomainIsPersistent(domain)) < 0)
goto cleanup;
rv = 0;
@@ -7693,13 +7511,10 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->dom);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- ret->updated = virDomainIsUpdated(domain);
-
- if (ret->updated < 0)
+ if ((ret->updated = virDomainIsUpdated(domain)) < 0)
goto cleanup;
rv = 0;
@@ -7728,13 +7543,10 @@ static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE
goto cleanup;
}
- iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL)
+ if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
- ret->active = virInterfaceIsActive(iface);
-
- if (ret->active < 0)
+ if ((ret->active = virInterfaceIsActive(iface)) < 0)
goto cleanup;
rv = 0;
@@ -7763,13 +7575,10 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- network = get_nonnull_network(conn, args->net);
- if (network == NULL)
+ if (!(network = get_nonnull_network(conn, args->net)))
goto cleanup;
- ret->active = virNetworkIsActive(network);
-
- if (ret->active < 0)
+ if ((ret->active = virNetworkIsActive(network)) < 0)
goto cleanup;
rv = 0;
@@ -7798,13 +7607,10 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
goto cleanup;
}
- network = get_nonnull_network(conn, args->net);
- if (network == NULL)
+ if (!(network = get_nonnull_network(conn, args->net)))
goto cleanup;
- ret->persistent = virNetworkIsPersistent(network);
-
- if (ret->persistent < 0)
+ if ((ret->persistent = virNetworkIsPersistent(network)) < 0)
goto cleanup;
rv = 0;
@@ -7833,13 +7639,10 @@ static int remoteDispatchStoragePoolIsActive(struct qemud_server *server ATTRIBU
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
- ret->active = virStoragePoolIsActive(pool);
-
- if (ret->active < 0)
+ if ((ret->active = virStoragePoolIsActive(pool)) < 0)
goto cleanup;
rv = 0;
@@ -7868,13 +7671,10 @@ static int remoteDispatchStoragePoolIsPersistent(struct qemud_server *server ATT
goto cleanup;
}
- pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL)
+ if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
- ret->persistent = virStoragePoolIsPersistent(pool);
-
- if (ret->persistent < 0)
+ if ((ret->persistent = virStoragePoolIsPersistent(pool)) < 0)
goto cleanup;
rv = 0;
@@ -7903,9 +7703,7 @@ static int remoteDispatchIsSecure(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->secure = virConnectIsSecure(conn);
-
- if (ret->secure < 0)
+ if ((ret->secure = virConnectIsSecure(conn)) < 0)
goto cleanup;
rv = 0;
@@ -7934,8 +7732,7 @@ remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- result = virConnectCompareCPU(conn, args->xml, args->flags);
- if (result == VIR_CPU_COMPARE_ERROR)
+ if ((result = virConnectCompareCPU(conn, args->xml, args->flags)) == VIR_CPU_COMPARE_ERROR)
goto cleanup;
ret->result = result;
@@ -7965,11 +7762,10 @@ remoteDispatchCpuBaseline(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- cpu = virConnectBaselineCPU(conn,
- (const char **) args->xmlCPUs.xmlCPUs_val,
- args->xmlCPUs.xmlCPUs_len,
- args->flags);
- if (cpu == NULL)
+ if (!(cpu = virConnectBaselineCPU(conn,
+ (const char **) args->xmlCPUs.xmlCPUs_val,
+ args->xmlCPUs.xmlCPUs_len,
+ args->flags)))
goto cleanup;
ret->cpu = cpu;
@@ -8001,8 +7797,7 @@ remoteDispatchDomainGetJobInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetJobInfo(dom, &info) < 0)
@@ -8049,8 +7844,7 @@ remoteDispatchDomainAbortJob(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAbortJob(dom) < 0)
@@ -8084,8 +7878,7 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) < 0)
@@ -8118,8 +7911,7 @@ remoteDispatchDomainMigrateSetMaxSpeed(struct qemud_server *server ATTRIBUTE_UNU
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) < 0)
@@ -8153,12 +7945,10 @@ remoteDispatchDomainSnapshotCreateXml(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- snapshot = virDomainSnapshotCreateXML(domain, args->xml_desc, args->flags);
- if (snapshot == NULL)
+ if (!(snapshot = virDomainSnapshotCreateXML(domain, args->xml_desc, args->flags)))
goto cleanup;
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8193,17 +7983,14 @@ remoteDispatchDomainSnapshotDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->snap.domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
- snapshot = get_nonnull_domain_snapshot(domain, args->snap);
- if (snapshot == NULL)
+ if (!(snapshot = get_nonnull_domain_snapshot(domain, args->snap)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virDomainSnapshotGetXMLDesc(snapshot, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virDomainSnapshotGetXMLDesc(snapshot, args->flags)))
goto cleanup;
rv = 0;
@@ -8235,12 +8022,10 @@ remoteDispatchDomainSnapshotNum(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- ret->num = virDomainSnapshotNum(domain, args->flags);
- if (ret->num < 0)
+ if ((ret->num = virDomainSnapshotNum(domain, args->flags)) < 0)
goto cleanup;
rv = 0;
@@ -8277,8 +8062,7 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
/* Allocate return buffer. */
@@ -8325,12 +8109,10 @@ remoteDispatchDomainSnapshotLookupByName(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- snapshot = virDomainSnapshotLookupByName(domain, args->name, args->flags);
- if (snapshot == NULL)
+ if (!(snapshot = virDomainSnapshotLookupByName(domain, args->name, args->flags)))
goto cleanup;
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8365,8 +8147,7 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
result = virDomainHasCurrentSnapshot(domain, args->flags);
@@ -8403,12 +8184,10 @@ remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- snapshot = virDomainSnapshotCurrent(domain, args->flags);
- if (snapshot == NULL)
+ if (!(snapshot = virDomainSnapshotCurrent(domain, args->flags)))
goto cleanup;
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8443,12 +8222,10 @@ remoteDispatchDomainRevertToSnapshot(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->snap.domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
- snapshot = get_nonnull_domain_snapshot(domain, args->snap);
- if (snapshot == NULL)
+ if (!(snapshot = get_nonnull_domain_snapshot(domain, args->snap)))
goto cleanup;
if (virDomainRevertToSnapshot(snapshot, args->flags) < 0)
@@ -8484,12 +8261,10 @@ remoteDispatchDomainSnapshotDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->snap.domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
- snapshot = get_nonnull_domain_snapshot(domain, args->snap);
- if (snapshot == NULL)
+ if (!(snapshot = get_nonnull_domain_snapshot(domain, args->snap)))
goto cleanup;
if (virDomainSnapshotDelete(snapshot, args->flags) < 0)
@@ -8577,8 +8352,7 @@ remoteDispatchDomainEventsDeregisterAny(struct qemud_server *server ATTRIBUTE_UN
goto cleanup;
}
- callbackID = client->domainEventCallbackID[args->eventID];
- if (callbackID < 0) {
+ if ((callbackID = client->domainEventCallbackID[args->eventID]) < 0) {
virNetError(VIR_ERR_INTERNAL_ERROR, _("domain event %d not registered"), args->eventID);
goto cleanup;
}
@@ -8614,8 +8388,7 @@ remoteDispatchNwfilterLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- nwfilter = virNWFilterLookupByName(conn, args->name);
- if (nwfilter == NULL)
+ if (!(nwfilter = virNWFilterLookupByName(conn, args->name)))
goto cleanup;
make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
@@ -8647,8 +8420,7 @@ remoteDispatchNwfilterLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- nwfilter = virNWFilterLookupByUUID(conn, (unsigned char *) args->uuid);
- if (nwfilter == NULL)
+ if (!(nwfilter = virNWFilterLookupByUUID(conn, (unsigned char *) args->uuid)))
goto cleanup;
make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
@@ -8681,8 +8453,7 @@ remoteDispatchNwfilterDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- nwfilter = virNWFilterDefineXML(conn, args->xml);
- if (nwfilter == NULL)
+ if (!(nwfilter = virNWFilterDefineXML(conn, args->xml)))
goto cleanup;
make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
@@ -8715,8 +8486,7 @@ remoteDispatchNwfilterUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- nwfilter = get_nonnull_nwfilter(conn, args->nwfilter);
- if (nwfilter == NULL)
+ if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))
goto cleanup;
if (virNWFilterUndefine(nwfilter) < 0)
@@ -8795,13 +8565,11 @@ remoteDispatchNwfilterGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- nwfilter = get_nonnull_nwfilter(conn, args->nwfilter);
- if (nwfilter == NULL)
+ if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
- ret->xml = virNWFilterGetXMLDesc(nwfilter, args->flags);
- if (!ret->xml)
+ if (!(ret->xml = virNWFilterGetXMLDesc(nwfilter, args->flags)))
goto cleanup;
rv = 0;
@@ -8831,8 +8599,7 @@ remoteDispatchNumOfNwfilters(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- ret->num = virConnectNumOfNWFilters(conn);
- if (ret->num < 0)
+ if ((ret->num = virConnectNumOfNWFilters(conn)) < 0)
goto cleanup;
rv = 0;
@@ -8862,8 +8629,7 @@ remoteDispatchDomainGetBlockInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetBlockInfo(dom, args->path, &info, args->flags) < 0)
@@ -8900,8 +8666,7 @@ qemuDispatchMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL)
+ if (!(domain = get_nonnull_domain(conn, args->domain)))
goto cleanup;
if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
@@ -8928,7 +8693,6 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_open_console_args *args,
void *ret ATTRIBUTE_UNUSED)
{
- int r;
struct qemud_client_stream *stream = NULL;
virDomainPtr dom = NULL;
int rv = -1;
@@ -8938,21 +8702,18 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- dom = get_nonnull_domain(conn, args->domain);
- if (dom == NULL)
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- stream = remoteCreateClientStream(conn, hdr);
- if (!stream) {
+ if (!(stream = remoteCreateClientStream(conn, hdr))) {
virReportOOMError();
goto cleanup;
}
- r = virDomainOpenConsole(dom,
+ if (virDomainOpenConsole(dom,
args->devname ? *args->devname : NULL,
stream->st,
- args->flags);
- if (r < 0)
+ args->flags) < 0)
goto cleanup;
if (remoteAddClientStream(client, stream, 1) < 0)
--
1.7.4.2
13 years, 8 months
[libvirt] [PATCH] Remove curly braces on all single-line conditional jumps in dispatcher
by Daniel P. Berrange
Replace all occurrances of
if (....) {
goto cleanup;
}
With
if (.....)
goto cleanup;
to save one line of code
* daemon/remote.c: Remove curly braces on single line conditionals
---
daemon/remote.c | 951 ++++++++++++++++++------------------------------------
1 files changed, 317 insertions(+), 634 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 325ba90..247a226 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -427,9 +427,8 @@ remoteDispatchOpen(struct qemud_server *server,
? virConnectOpenReadOnly(name)
: virConnectOpen(name);
- if (client->conn == NULL) {
+ if (client->conn == NULL)
goto cleanup;
- }
rv = 0;
@@ -476,9 +475,8 @@ remoteDispatchSupportsFeature(struct qemud_server *server ATTRIBUTE_UNUSED,
ret->supported = virDrvSupportsFeature(conn, args->feature);
- if (ret->supported < 0) {
+ if (ret->supported < 0)
goto cleanup;
- }
rv = 0;
@@ -505,9 +503,8 @@ remoteDispatchGetType(struct qemud_server *server ATTRIBUTE_UNUSED,
}
type = virConnectGetType(conn);
- if (type == NULL) {
+ if (type == NULL)
goto cleanup;
- }
/* We have to strdup because remoteDispatchClientRequest will
* free this string after it's been serialised.
@@ -543,9 +540,8 @@ remoteDispatchGetVersion(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virConnectGetVersion(conn, &hvVer) < 0) {
+ if (virConnectGetVersion(conn, &hvVer) < 0)
goto cleanup;
- }
ret->hv_ver = hvVer;
rv = 0;
@@ -573,9 +569,8 @@ remoteDispatchGetLibVersion(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virConnectGetLibVersion(conn, &libVer) < 0) {
+ if (virConnectGetLibVersion(conn, &libVer) < 0)
goto cleanup;
- }
ret->lib_ver = libVer;
rv = 0;
@@ -604,9 +599,8 @@ remoteDispatchGetHostname(struct qemud_server *server ATTRIBUTE_UNUSED,
}
hostname = virConnectGetHostname(conn);
- if (hostname == NULL) {
+ if (hostname == NULL)
goto cleanup;
- }
ret->hostname = hostname;
rv = 0;
@@ -635,9 +629,8 @@ remoteDispatchGetUri(struct qemud_server *server ATTRIBUTE_UNUSED,
}
uri = virConnectGetURI(conn);
- if (uri == NULL) {
+ if (uri == NULL)
goto cleanup;
- }
ret->uri = uri;
rv = 0;
@@ -668,9 +661,8 @@ remoteDispatchGetSysinfo(struct qemud_server *server ATTRIBUTE_UNUSED,
flags = args->flags;
sysinfo = virConnectGetSysinfo(conn, flags);
- if (sysinfo == NULL) {
+ if (sysinfo == NULL)
goto cleanup;
- }
ret->sysinfo = sysinfo;
rv = 0;
@@ -700,9 +692,8 @@ remoteDispatchGetMaxVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
type = args->type ? *args->type : NULL;
ret->max_vcpus = virConnectGetMaxVcpus(conn, type);
- if (ret->max_vcpus < 0) {
+ if (ret->max_vcpus < 0)
goto cleanup;
- }
rv = 0;
@@ -729,9 +720,8 @@ remoteDispatchNodeGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virNodeGetInfo(conn, &info) < 0) {
+ if (virNodeGetInfo(conn, &info) < 0)
goto cleanup;
- }
memcpy(ret->model, info.model, sizeof ret->model);
ret->memory = info.memory;
@@ -768,9 +758,8 @@ remoteDispatchGetCapabilities(struct qemud_server *server ATTRIBUTE_UNUSED,
}
caps = virConnectGetCapabilities(conn);
- if (caps == NULL) {
+ if (caps == NULL)
goto cleanup;
- }
ret->capabilities = caps;
rv = 0;
@@ -814,9 +803,8 @@ remoteDispatchNodeGetCellsFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSE
(unsigned long long *)ret->freeMems.freeMems_val,
args->startCell,
args->maxCells);
- if (err <= 0) {
+ if (err <= 0)
goto cleanup;
- }
ret->freeMems.freeMems_len = err;
rv = 0;
@@ -848,9 +836,8 @@ remoteDispatchNodeGetFreeMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
}
freeMem = virNodeGetFreeMemory(conn);
- if (freeMem == 0) {
+ if (freeMem == 0)
goto cleanup;
- }
ret->freeMem = freeMem;
rv = 0;
@@ -881,14 +868,12 @@ remoteDispatchDomainGetSchedulerType(struct qemud_server *server ATTRIBUTE_UNUSE
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
type = virDomainGetSchedulerType(dom, &nparams);
- if (type == NULL) {
+ if (type == NULL)
goto cleanup;
- }
ret->type = type;
ret->nparams = nparams;
@@ -933,14 +918,12 @@ remoteDispatchDomainGetSchedulerParameters(struct qemud_server *server ATTRIBUTE
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
r = virDomainGetSchedulerParameters(dom, params, &nparams);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
/* Serialise the scheduler parameters. */
ret->params.params_len = nparams;
@@ -1046,14 +1029,12 @@ remoteDispatchDomainSetSchedulerParameters(struct qemud_server *server ATTRIBUTE
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
r = virDomainSetSchedulerParameters(dom, params, nparams);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
rv = 0;
@@ -1086,14 +1067,12 @@ remoteDispatchDomainBlockStats(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
path = args->path;
- if (virDomainBlockStats(dom, path, &stats, sizeof stats) < 0) {
+ if (virDomainBlockStats(dom, path, &stats, sizeof stats) < 0)
goto cleanup;
- }
ret->rd_req = stats.rd_req;
ret->rd_bytes = stats.rd_bytes;
@@ -1131,14 +1110,12 @@ remoteDispatchDomainInterfaceStats(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
path = args->path;
- if (virDomainInterfaceStats(dom, path, &stats, sizeof stats) < 0) {
+ if (virDomainInterfaceStats(dom, path, &stats, sizeof stats) < 0)
goto cleanup;
- }
ret->rx_bytes = stats.rx_bytes;
ret->rx_packets = stats.rx_packets;
@@ -1185,9 +1162,8 @@ remoteDispatchDomainMemoryStats(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
/* Allocate stats array for making dispatch call */
if (VIR_ALLOC_N(stats, args->maxStats) < 0) {
@@ -1196,9 +1172,8 @@ remoteDispatchDomainMemoryStats(struct qemud_server *server ATTRIBUTE_UNUSED,
}
nr_stats = virDomainMemoryStats(dom, stats, args->maxStats, 0);
- if (nr_stats < 0) {
+ if (nr_stats < 0)
goto cleanup;
- }
/* Allocate return buffer */
if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0) {
@@ -1245,9 +1220,8 @@ remoteDispatchDomainBlockPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
path = args->path;
offset = args->offset;
size = args->size;
@@ -1266,9 +1240,8 @@ remoteDispatchDomainBlockPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainBlockPeek(dom, path, offset, size,
- ret->buffer.buffer_val, flags) < 0) {
+ ret->buffer.buffer_val, flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -1303,9 +1276,8 @@ remoteDispatchDomainMemoryPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
offset = args->offset;
size = args->size;
flags = args->flags;
@@ -1323,9 +1295,8 @@ remoteDispatchDomainMemoryPeek(struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainMemoryPeek(dom, offset, size,
- ret->buffer.buffer_val, flags) < 0) {
+ ret->buffer.buffer_val, flags) < 0)
goto cleanup;
- }
if (dom)
virDomainFree(dom);
@@ -1359,13 +1330,11 @@ remoteDispatchDomainAttachDevice(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainAttachDevice(dom, args->xml) < 0) {
+ if (virDomainAttachDevice(dom, args->xml) < 0)
goto cleanup;
- }
rv = 0;
@@ -1395,13 +1364,11 @@ remoteDispatchDomainAttachDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUS
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) < 0) {
+ if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -1431,13 +1398,11 @@ remoteDispatchDomainUpdateDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUS
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) < 0) {
+ if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -1467,13 +1432,11 @@ remoteDispatchDomainCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainCreate(dom) < 0) {
+ if (virDomainCreate(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -1498,13 +1461,11 @@ remoteDispatchDomainCreateWithFlags(struct qemud_server *server ATTRIBUTE_UNUSED
virDomainPtr dom = NULL;
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainCreateWithFlags(dom, args->flags) < 0) {
+ if (virDomainCreateWithFlags(dom, args->flags) < 0)
goto cleanup;
- }
make_nonnull_domain(&ret->dom, dom);
@@ -1536,9 +1497,8 @@ remoteDispatchDomainCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = virDomainCreateXML(conn, args->xml_desc, args->flags);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->dom, dom);
@@ -1570,9 +1530,8 @@ remoteDispatchDomainDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = virDomainDefineXML(conn, args->xml);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->dom, dom);
@@ -1604,13 +1563,11 @@ remoteDispatchDomainDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainDestroy(dom) < 0) {
+ if (virDomainDestroy(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -1640,13 +1597,11 @@ remoteDispatchDomainDetachDevice(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainDetachDevice(dom, args->xml) < 0) {
+ if (virDomainDetachDevice(dom, args->xml) < 0)
goto cleanup;
- }
rv = 0;
@@ -1676,13 +1631,11 @@ remoteDispatchDomainDetachDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUS
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) < 0) {
+ if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -1712,15 +1665,13 @@ remoteDispatchDomainDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virDomainGetXMLDesc(dom, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -1753,9 +1704,8 @@ remoteDispatchDomainXmlFromNative(struct qemud_server *server ATTRIBUTE_UNUSED,
args->nativeFormat,
args->nativeConfig,
args->flags);
- if (!ret->domainXml) {
+ if (!ret->domainXml)
goto cleanup;
- }
rv = 0;
cleanup:
@@ -1785,9 +1735,8 @@ remoteDispatchDomainXmlToNative(struct qemud_server *server ATTRIBUTE_UNUSED,
args->nativeFormat,
args->domainXml,
args->flags);
- if (!ret->nativeConfig) {
+ if (!ret->nativeConfig)
goto cleanup;
- }
rv = 0;
cleanup:
@@ -1815,13 +1764,11 @@ remoteDispatchDomainGetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainGetAutostart(dom, &ret->autostart) < 0) {
+ if (virDomainGetAutostart(dom, &ret->autostart) < 0)
goto cleanup;
- }
rv = 0;
@@ -1852,13 +1799,11 @@ remoteDispatchDomainGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainGetInfo(dom, &info) < 0) {
+ if (virDomainGetInfo(dom, &info) < 0)
goto cleanup;
- }
ret->state = info.state;
ret->max_mem = info.maxMem;
@@ -1894,14 +1839,12 @@ remoteDispatchDomainGetMaxMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
ret->memory = virDomainGetMaxMemory(dom);
- if (ret->memory == 0) {
+ if (ret->memory == 0)
goto cleanup;
- }
rv = 0;
@@ -1931,14 +1874,12 @@ remoteDispatchDomainGetMaxVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
ret->num = virDomainGetMaxVcpus(dom);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -1969,18 +1910,16 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSE
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
if (VIR_ALLOC(seclabel) < 0) {
virReportOOMError();
goto cleanup;
}
- if (virDomainGetSecurityLabel(dom, seclabel) < 0) {
+ if (virDomainGetSecurityLabel(dom, seclabel) < 0)
goto cleanup;
- }
ret->label.label_len = strlen(seclabel->label) + 1;
if (VIR_ALLOC_N(ret->label.label_val, ret->label.label_len) < 0) {
@@ -2019,9 +1958,8 @@ remoteDispatchNodeGetSecurityModel(struct qemud_server *server ATTRIBUTE_UNUSED,
}
memset(&secmodel, 0, sizeof secmodel);
- if (virNodeGetSecurityModel(conn, &secmodel) < 0) {
+ if (virNodeGetSecurityModel(conn, &secmodel) < 0)
goto cleanup;
- }
ret->model.model_len = strlen(secmodel.model) + 1;
if (VIR_ALLOC_N(ret->model.model_val, ret->model.model_len) < 0) {
@@ -2063,15 +2001,13 @@ remoteDispatchDomainGetOsType(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this */
ret->type = virDomainGetOSType(dom);
- if (ret->type == NULL) {
+ if (ret->type == NULL)
goto cleanup;
- }
rv = 0;
cleanup:
@@ -2103,9 +2039,8 @@ remoteDispatchDomainGetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX"));
@@ -2127,9 +2062,8 @@ remoteDispatchDomainGetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
info_len = virDomainGetVcpus(dom,
info, args->maxinfo,
cpumaps, args->maplen);
- if (info_len < 0) {
+ if (info_len < 0)
goto cleanup;
- }
/* Allocate the return buffer for info. */
ret->info.info_len = info_len;
@@ -2187,14 +2121,12 @@ remoteDispatchDomainGetVcpusFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
ret->num = virDomainGetVcpusFlags(dom, args->flags);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -2240,9 +2172,8 @@ remoteDispatchDomainMigratePrepare(struct qemud_server *server ATTRIBUTE_UNUSED,
r = virDomainMigratePrepare(conn, &cookie, &cookielen,
uri_in, uri_out,
args->flags, dname, args->resource);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
/* remoteDispatchClientRequest will free cookie, uri_out and
* the string if there is one.
@@ -2285,9 +2216,8 @@ remoteDispatchDomainMigratePerform(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
dname = args->dname == NULL ? NULL : *args->dname;
@@ -2296,9 +2226,8 @@ remoteDispatchDomainMigratePerform(struct qemud_server *server ATTRIBUTE_UNUSED,
args->cookie.cookie_len,
args->uri,
args->flags, dname, args->resource);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
rv = 0;
@@ -2332,9 +2261,8 @@ remoteDispatchDomainMigrateFinish(struct qemud_server *server ATTRIBUTE_UNUSED,
args->cookie.cookie_len,
args->uri,
args->flags);
- if (ddom == NULL) {
+ if (ddom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->ddom, ddom);
rv = 0;
@@ -2382,9 +2310,8 @@ remoteDispatchDomainMigratePrepare2(struct qemud_server *server ATTRIBUTE_UNUSED
uri_in, uri_out,
args->flags, dname, args->resource,
args->dom_xml);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
/* remoteDispatchClientRequest will free cookie, uri_out and
* the string if there is one.
@@ -2424,9 +2351,8 @@ remoteDispatchDomainMigrateFinish2(struct qemud_server *server ATTRIBUTE_UNUSED,
args->uri,
args->flags,
args->retcode);
- if (ddom == NULL) {
+ if (ddom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->ddom, ddom);
@@ -2470,13 +2396,11 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_U
r = virDomainMigratePrepareTunnel(conn, stream->st,
args->flags, dname, args->resource,
args->dom_xml);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
- if (remoteAddClientStream(client, stream, 0) < 0) {
+ if (remoteAddClientStream(client, stream, 0) < 0)
goto cleanup;
- }
rv = 0;
@@ -2522,9 +2446,8 @@ remoteDispatchListDefinedDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListDefinedDomains(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -2555,9 +2478,8 @@ remoteDispatchDomainLookupById(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = virDomainLookupByID(conn, args->id);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->dom, dom);
@@ -2589,9 +2511,8 @@ remoteDispatchDomainLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = virDomainLookupByName(conn, args->name);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->dom, dom);
@@ -2623,9 +2544,8 @@ remoteDispatchDomainLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = virDomainLookupByUUID(conn, (unsigned char *) args->uuid);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
make_nonnull_domain(&ret->dom, dom);
@@ -2656,9 +2576,8 @@ remoteDispatchNumOfDefinedDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfDefinedDomains(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -2686,9 +2605,8 @@ remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("cpumap_len > REMOTE_CPUMAP_MAX"));
@@ -2698,9 +2616,8 @@ remoteDispatchDomainPinVcpu(struct qemud_server *server ATTRIBUTE_UNUSED,
rv = virDomainPinVcpu(dom, args->vcpu,
(unsigned char *) args->cpumap.cpumap_val,
args->cpumap.cpumap_len);
- if (rv < 0) {
+ if (rv < 0)
goto cleanup;
- }
rv = 0;
@@ -2730,13 +2647,11 @@ remoteDispatchDomainReboot(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainReboot(dom, args->flags) < 0) {
+ if (virDomainReboot(dom, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -2764,9 +2679,8 @@ remoteDispatchDomainRestore(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virDomainRestore(conn, args->from) < 0) {
+ if (virDomainRestore(conn, args->from) < 0)
goto cleanup;
- }
rv = 0;
@@ -2794,13 +2708,11 @@ remoteDispatchDomainResume(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainResume(dom) < 0) {
+ if (virDomainResume(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -2830,13 +2742,11 @@ remoteDispatchDomainSave(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSave(dom, args->to) < 0) {
+ if (virDomainSave(dom, args->to) < 0)
goto cleanup;
- }
rv = 0;
@@ -2866,13 +2776,11 @@ remoteDispatchDomainCoreDump(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainCoreDump(dom, args->to, args->flags) < 0) {
+ if (virDomainCoreDump(dom, args->to, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -2902,13 +2810,11 @@ remoteDispatchDomainSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSetAutostart(dom, args->autostart) < 0) {
+ if (virDomainSetAutostart(dom, args->autostart) < 0)
goto cleanup;
- }
rv = 0;
@@ -2938,13 +2844,11 @@ remoteDispatchDomainSetMaxMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSetMaxMemory(dom, args->memory) < 0) {
+ if (virDomainSetMaxMemory(dom, args->memory) < 0)
goto cleanup;
- }
rv = 0;
@@ -2974,13 +2878,11 @@ remoteDispatchDomainSetMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSetMemory(dom, args->memory) < 0) {
+ if (virDomainSetMemory(dom, args->memory) < 0)
goto cleanup;
- }
rv = 0;
@@ -3010,13 +2912,11 @@ remoteDispatchDomainSetMemoryFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSetMemoryFlags(dom, args->memory, args->flags) < 0) {
+ if (virDomainSetMemoryFlags(dom, args->memory, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -3108,14 +3008,12 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
r = virDomainSetMemoryParameters(dom, params, nparams, flags);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
rv = 0;
@@ -3166,14 +3064,12 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
r = virDomainGetMemoryParameters(dom, params, &nparams, flags);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
/* In this case, we need to send back the number of parameters
* supported
*/
@@ -3329,14 +3225,12 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
r = virDomainSetBlkioParameters(dom, params, nparams, flags);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
rv = 0;
@@ -3387,14 +3281,12 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
r = virDomainGetBlkioParameters(dom, params, &nparams, flags);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
/* In this case, we need to send back the number of parameters
* supported
*/
@@ -3490,13 +3382,11 @@ remoteDispatchDomainSetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSetVcpus(dom, args->nvcpus) < 0) {
+ if (virDomainSetVcpus(dom, args->nvcpus) < 0)
goto cleanup;
- }
rv = 0;
@@ -3526,13 +3416,11 @@ remoteDispatchDomainSetVcpusFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) < 0) {
+ if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -3562,13 +3450,11 @@ remoteDispatchDomainShutdown(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainShutdown(dom) < 0) {
+ if (virDomainShutdown(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -3598,13 +3484,11 @@ remoteDispatchDomainSuspend(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainSuspend(dom) < 0) {
+ if (virDomainSuspend(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -3634,13 +3518,11 @@ remoteDispatchDomainUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainUndefine(dom) < 0) {
+ if (virDomainUndefine(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -3683,9 +3565,8 @@ remoteDispatchListDefinedNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListDefinedNetworks(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -3729,9 +3610,8 @@ remoteDispatchListDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListDomains(conn,
ret->ids.ids_val, args->maxids);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->ids.ids_len = len;
rv = 0;
@@ -3762,13 +3642,11 @@ remoteDispatchDomainManagedSave(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainManagedSave(dom, args->flags) < 0) {
+ if (virDomainManagedSave(dom, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -3798,14 +3676,12 @@ remoteDispatchDomainHasManagedSaveImage(struct qemud_server *server ATTRIBUTE_UN
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
ret->ret = virDomainHasManagedSaveImage(dom, args->flags);
- if (ret->ret < 0) {
+ if (ret->ret < 0)
goto cleanup;
- }
rv = 0;
@@ -3835,13 +3711,11 @@ remoteDispatchDomainManagedSaveRemove(struct qemud_server *server ATTRIBUTE_UNUS
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainManagedSaveRemove(dom, args->flags) < 0) {
+ if (virDomainManagedSaveRemove(dom, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -3884,9 +3758,8 @@ remoteDispatchListNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListNetworks(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -3917,13 +3790,11 @@ remoteDispatchNetworkCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
- if (virNetworkCreate(net) < 0) {
+ if (virNetworkCreate(net) < 0)
goto cleanup;
- }
rv = 0;
@@ -3953,9 +3824,8 @@ remoteDispatchNetworkCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = virNetworkCreateXML(conn, args->xml);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
make_nonnull_network(&ret->net, net);
@@ -3987,9 +3857,8 @@ remoteDispatchNetworkDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = virNetworkDefineXML(conn, args->xml);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
make_nonnull_network(&ret->net, net);
@@ -4021,13 +3890,11 @@ remoteDispatchNetworkDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
- if (virNetworkDestroy(net) < 0) {
+ if (virNetworkDestroy(net) < 0)
goto cleanup;
- }
rv = 0;
@@ -4057,15 +3924,13 @@ remoteDispatchNetworkDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virNetworkGetXMLDesc(net, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -4095,13 +3960,11 @@ remoteDispatchNetworkGetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
- if (virNetworkGetAutostart(net, &ret->autostart) < 0) {
+ if (virNetworkGetAutostart(net, &ret->autostart) < 0)
goto cleanup;
- }
rv = 0;
@@ -4131,15 +3994,13 @@ remoteDispatchNetworkGetBridgeName(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->name = virNetworkGetBridgeName(net);
- if (!ret->name) {
+ if (!ret->name)
goto cleanup;
- }
rv = 0;
@@ -4169,9 +4030,8 @@ remoteDispatchNetworkLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = virNetworkLookupByName(conn, args->name);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
make_nonnull_network(&ret->net, net);
@@ -4203,9 +4063,8 @@ remoteDispatchNetworkLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
make_nonnull_network(&ret->net, net);
@@ -4237,13 +4096,11 @@ remoteDispatchNetworkSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
- if (virNetworkSetAutostart(net, args->autostart) < 0) {
+ if (virNetworkSetAutostart(net, args->autostart) < 0)
goto cleanup;
- }
rv = 0;
@@ -4273,13 +4130,11 @@ remoteDispatchNetworkUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
}
net = get_nonnull_network(conn, args->net);
- if (net == NULL) {
+ if (net == NULL)
goto cleanup;
- }
- if (virNetworkUndefine(net) < 0) {
+ if (virNetworkUndefine(net) < 0)
goto cleanup;
- }
rv = 0;
@@ -4309,9 +4164,8 @@ remoteDispatchNumOfDefinedNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
}
len = virConnectNumOfDefinedNetworks(conn);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->num = len;
rv = 0;
@@ -4339,9 +4193,8 @@ remoteDispatchNumOfDomains(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfDomains(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -4368,9 +4221,8 @@ remoteDispatchNumOfNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfNetworks(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -4399,9 +4251,8 @@ remoteDispatchNumOfInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfInterfaces(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -4442,9 +4293,8 @@ remoteDispatchListInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListInterfaces(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -4475,9 +4325,8 @@ remoteDispatchNumOfDefinedInterfaces(struct qemud_server *server ATTRIBUTE_UNUSE
}
len = virConnectNumOfDefinedInterfaces(conn);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->num = len;
rv = 0;
@@ -4519,9 +4368,8 @@ remoteDispatchListDefinedInterfaces(struct qemud_server *server ATTRIBUTE_UNUSED
len = virConnectListDefinedInterfaces(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -4552,9 +4400,8 @@ remoteDispatchInterfaceLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED
}
iface = virInterfaceLookupByName(conn, args->name);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
make_nonnull_interface(&ret->iface, iface);
@@ -4586,9 +4433,8 @@ remoteDispatchInterfaceLookupByMacString(struct qemud_server *server ATTRIBUTE_U
}
iface = virInterfaceLookupByMACString(conn, args->mac);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
make_nonnull_interface(&ret->iface, iface);
@@ -4620,15 +4466,13 @@ remoteDispatchInterfaceGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
}
iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virInterfaceGetXMLDesc(iface, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -4658,9 +4502,8 @@ remoteDispatchInterfaceDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
iface = virInterfaceDefineXML(conn, args->xml, args->flags);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
make_nonnull_interface(&ret->iface, iface);
@@ -4692,13 +4535,11 @@ remoteDispatchInterfaceUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
}
iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
- if (virInterfaceUndefine(iface) < 0) {
+ if (virInterfaceUndefine(iface) < 0)
goto cleanup;
- }
rv = 0;
@@ -4728,13 +4569,11 @@ remoteDispatchInterfaceCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
}
iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
- if (virInterfaceCreate(iface, args->flags) < 0) {
+ if (virInterfaceCreate(iface, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -4764,13 +4603,11 @@ remoteDispatchInterfaceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
- if (virInterfaceDestroy(iface, args->flags) < 0) {
+ if (virInterfaceDestroy(iface, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -4857,9 +4694,8 @@ remoteDispatchAuthSaslInit(struct qemud_server *server,
virStrerror(errno, ebuf, sizeof ebuf));
goto error;
}
- if ((localAddr = virSocketFormatAddrFull(&sa, true, ";")) == NULL) {
+ if ((localAddr = virSocketFormatAddrFull(&sa, true, ";")) == NULL)
goto error;
- }
/* Get remote address in form IPADDR:PORT */
sa.len = sizeof(sa.data.stor);
@@ -5617,9 +5453,8 @@ remoteDispatchListDefinedStoragePools(struct qemud_server *server ATTRIBUTE_UNUS
len = virConnectListDefinedStoragePools(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -5663,9 +5498,8 @@ remoteDispatchListStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListStoragePools(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -5699,9 +5533,8 @@ remoteDispatchFindStoragePoolSources(struct qemud_server *server ATTRIBUTE_UNUSE
args->type,
args->srcSpec ? *args->srcSpec : NULL,
args->flags);
- if (ret->xml == NULL) {
+ if (ret->xml == NULL)
goto cleanup;
- }
rv = 0;
@@ -5730,13 +5563,11 @@ remoteDispatchStoragePoolCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolCreate(pool, args->flags) < 0) {
+ if (virStoragePoolCreate(pool, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -5766,9 +5597,8 @@ remoteDispatchStoragePoolCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = virStoragePoolCreateXML(conn, args->xml, args->flags);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
make_nonnull_storage_pool(&ret->pool, pool);
@@ -5800,9 +5630,8 @@ remoteDispatchStoragePoolDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = virStoragePoolDefineXML(conn, args->xml, args->flags);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
make_nonnull_storage_pool(&ret->pool, pool);
@@ -5834,13 +5663,11 @@ remoteDispatchStoragePoolBuild(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolBuild(pool, args->flags) < 0) {
+ if (virStoragePoolBuild(pool, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -5871,13 +5698,11 @@ remoteDispatchStoragePoolDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolDestroy(pool) < 0) {
+ if (virStoragePoolDestroy(pool) < 0)
goto cleanup;
- }
rv = 0;
@@ -5907,13 +5732,11 @@ remoteDispatchStoragePoolDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolDelete(pool, args->flags) < 0) {
+ if (virStoragePoolDelete(pool, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -5943,13 +5766,11 @@ remoteDispatchStoragePoolRefresh(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolRefresh(pool, args->flags) < 0) {
+ if (virStoragePoolRefresh(pool, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -5980,13 +5801,11 @@ remoteDispatchStoragePoolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolGetInfo(pool, &info) < 0) {
+ if (virStoragePoolGetInfo(pool, &info) < 0)
goto cleanup;
- }
ret->state = info.state;
ret->capacity = info.capacity;
@@ -6021,15 +5840,13 @@ remoteDispatchStoragePoolDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virStoragePoolGetXMLDesc(pool, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -6059,13 +5876,11 @@ remoteDispatchStoragePoolGetAutostart(struct qemud_server *server ATTRIBUTE_UNUS
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolGetAutostart(pool, &ret->autostart) < 0) {
+ if (virStoragePoolGetAutostart(pool, &ret->autostart) < 0)
goto cleanup;
- }
rv = 0;
@@ -6096,9 +5911,8 @@ remoteDispatchStoragePoolLookupByName(struct qemud_server *server ATTRIBUTE_UNUS
}
pool = virStoragePoolLookupByName(conn, args->name);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
make_nonnull_storage_pool(&ret->pool, pool);
@@ -6130,9 +5944,8 @@ remoteDispatchStoragePoolLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUS
}
pool = virStoragePoolLookupByUUID(conn, (unsigned char *) args->uuid);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
make_nonnull_storage_pool(&ret->pool, pool);
@@ -6165,14 +5978,12 @@ remoteDispatchStoragePoolLookupByVolume(struct qemud_server *server ATTRIBUTE_UN
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
pool = virStoragePoolLookupByVolume(vol);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
make_nonnull_storage_pool(&ret->pool, pool);
@@ -6206,13 +6017,11 @@ remoteDispatchStoragePoolSetAutostart(struct qemud_server *server ATTRIBUTE_UNUS
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolSetAutostart(pool, args->autostart) < 0) {
+ if (virStoragePoolSetAutostart(pool, args->autostart) < 0)
goto cleanup;
- }
rv = 0;
@@ -6242,13 +6051,11 @@ remoteDispatchStoragePoolUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
- if (virStoragePoolUndefine(pool) < 0) {
+ if (virStoragePoolUndefine(pool) < 0)
goto cleanup;
- }
rv = 0;
@@ -6277,9 +6084,8 @@ remoteDispatchNumOfStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfStoragePools(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -6306,9 +6112,8 @@ remoteDispatchNumOfDefinedStoragePools(struct qemud_server *server ATTRIBUTE_UNU
}
ret->num = virConnectNumOfDefinedStoragePools(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -6343,9 +6148,8 @@ remoteDispatchStoragePoolListVolumes(struct qemud_server *server ATTRIBUTE_UNUSE
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
@@ -6355,9 +6159,8 @@ remoteDispatchStoragePoolListVolumes(struct qemud_server *server ATTRIBUTE_UNUSE
len = virStoragePoolListVolumes(pool,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -6391,14 +6194,12 @@ remoteDispatchStoragePoolNumOfVolumes(struct qemud_server *server ATTRIBUTE_UNUS
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
ret->num = virStoragePoolNumOfVolumes(pool);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -6436,14 +6237,12 @@ remoteDispatchStorageVolCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
vol = virStorageVolCreateXML(pool, args->xml, args->flags);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
make_nonnull_storage_vol(&ret->vol, vol);
rv = 0;
@@ -6478,20 +6277,17 @@ remoteDispatchStorageVolCreateXmlFrom(struct qemud_server *server ATTRIBUTE_UNUS
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
clonevol = get_nonnull_storage_vol(conn, args->clonevol);
- if (clonevol == NULL) {
+ if (clonevol == NULL)
goto cleanup;
- }
newvol = virStorageVolCreateXMLFrom(pool, args->xml, clonevol,
args->flags);
- if (newvol == NULL) {
+ if (newvol == NULL)
goto cleanup;
- }
make_nonnull_storage_vol(&ret->vol, newvol);
rv = 0;
@@ -6526,13 +6322,11 @@ remoteDispatchStorageVolDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
- if (virStorageVolDelete(vol, args->flags) < 0) {
+ if (virStorageVolDelete(vol, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -6562,13 +6356,11 @@ remoteDispatchStorageVolWipe(struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
- if (virStorageVolWipe(vol, args->flags) < 0) {
+ if (virStorageVolWipe(vol, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -6599,13 +6391,11 @@ remoteDispatchStorageVolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
- if (virStorageVolGetInfo(vol, &info) < 0) {
+ if (virStorageVolGetInfo(vol, &info) < 0)
goto cleanup;
- }
ret->type = info.type;
ret->capacity = info.capacity;
@@ -6639,15 +6429,13 @@ remoteDispatchStorageVolDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virStorageVolGetXMLDesc(vol, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -6678,15 +6466,13 @@ remoteDispatchStorageVolGetPath(struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->name = virStorageVolGetPath(vol);
- if (!ret->name) {
+ if (!ret->name)
goto cleanup;
- }
rv = 0;
@@ -6718,14 +6504,12 @@ remoteDispatchStorageVolLookupByName(struct qemud_server *server ATTRIBUTE_UNUSE
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
vol = virStorageVolLookupByName(pool, args->name);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6759,9 +6543,8 @@ remoteDispatchStorageVolLookupByKey(struct qemud_server *server ATTRIBUTE_UNUSED
}
vol = virStorageVolLookupByKey(conn, args->key);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6794,9 +6577,8 @@ remoteDispatchStorageVolLookupByPath(struct qemud_server *server ATTRIBUTE_UNUSE
}
vol = virStorageVolLookupByPath(conn, args->path);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
make_nonnull_storage_vol(&ret->vol, vol);
@@ -6834,9 +6616,8 @@ remoteDispatchNodeNumOfDevices(struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virNodeNumOfDevices(conn,
args->cap ? *args->cap : NULL,
args->flags);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -6879,9 +6660,8 @@ remoteDispatchNodeListDevices(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virNodeListDevices(conn,
args->cap ? *args->cap : NULL,
ret->names.names_val, args->maxnames, args->flags);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -6913,9 +6693,8 @@ remoteDispatchNodeDeviceLookupByName(struct qemud_server *server ATTRIBUTE_UNUSE
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
make_nonnull_node_device(&ret->dev, dev);
@@ -6948,15 +6727,13 @@ remoteDispatchNodeDeviceDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virNodeDeviceGetXMLDesc(dev, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -6988,9 +6765,8 @@ remoteDispatchNodeDeviceGetParent(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
parent = virNodeDeviceGetParent(dev);
@@ -7040,14 +6816,12 @@ remoteDispatchNodeDeviceNumOfCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
ret->num = virNodeDeviceNumOfCaps(dev);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -7079,9 +6853,8 @@ remoteDispatchNodeDeviceListCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
virNetError(VIR_ERR_INTERNAL_ERROR,
@@ -7097,9 +6870,8 @@ remoteDispatchNodeDeviceListCaps(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virNodeDeviceListCaps(dev, ret->names.names_val,
args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -7133,13 +6905,11 @@ remoteDispatchNodeDeviceDettach(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
- if (virNodeDeviceDettach(dev) < 0) {
+ if (virNodeDeviceDettach(dev) < 0)
goto cleanup;
- }
rv = 0;
@@ -7170,13 +6940,11 @@ remoteDispatchNodeDeviceReAttach(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
- if (virNodeDeviceReAttach(dev) < 0) {
+ if (virNodeDeviceReAttach(dev) < 0)
goto cleanup;
- }
rv = 0;
@@ -7207,13 +6975,11 @@ remoteDispatchNodeDeviceReset(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
- if (virNodeDeviceReset(dev) < 0) {
+ if (virNodeDeviceReset(dev) < 0)
goto cleanup;
- }
rv = 0;
@@ -7244,9 +7010,8 @@ remoteDispatchNodeDeviceCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
make_nonnull_node_device(&ret->dev, dev);
@@ -7279,13 +7044,11 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dev = virNodeDeviceLookupByName(conn, args->name);
- if (dev == NULL) {
+ if (dev == NULL)
goto cleanup;
- }
- if (virNodeDeviceDestroy(dev) < 0) {
+ if (virNodeDeviceDestroy(dev) < 0)
goto cleanup;
- }
rv = 0;
@@ -7315,24 +7078,20 @@ static int remoteDispatchStorageVolUpload(struct qemud_server *server ATTRIBUTE_
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
stream = remoteCreateClientStream(conn, hdr);
- if (!stream) {
+ if (!stream)
goto cleanup;
- }
if (virStorageVolUpload(vol, stream->st,
args->offset, args->length,
- args->flags) < 0) {
+ args->flags) < 0)
goto cleanup;
- }
- if (remoteAddClientStream(client, stream, 0) < 0) {
+ if (remoteAddClientStream(client, stream, 0) < 0)
goto cleanup;
- }
rv = 0;
@@ -7366,24 +7125,20 @@ static int remoteDispatchStorageVolDownload(struct qemud_server *server ATTRIBUT
}
vol = get_nonnull_storage_vol(conn, args->vol);
- if (vol == NULL) {
+ if (vol == NULL)
goto cleanup;
- }
stream = remoteCreateClientStream(conn, hdr);
- if (!stream) {
+ if (!stream)
goto cleanup;
- }
if (virStorageVolDownload(vol, stream->st,
args->offset, args->length,
- args->flags) < 0) {
+ args->flags) < 0)
goto cleanup;
- }
- if (remoteAddClientStream(client, stream, 1) < 0) {
+ if (remoteAddClientStream(client, stream, 1) < 0)
goto cleanup;
- }
rv = 0;
@@ -7429,9 +7184,8 @@ remoteDispatchDomainEventsRegister(struct qemud_server *server ATTRIBUTE_UNUSED,
NULL,
VIR_DOMAIN_EVENT_ID_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
- client, NULL)) < 0) {
+ client, NULL)) < 0)
goto cleanup;
- }
client->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE] = callbackID;
@@ -7465,9 +7219,8 @@ remoteDispatchDomainEventsDeregister(struct qemud_server *server ATTRIBUTE_UNUSE
}
if (virConnectDomainEventDeregisterAny(conn,
- client->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE]) < 0) {
+ client->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE]) < 0)
goto cleanup;
- }
client->domainEventCallbackID[VIR_DOMAIN_EVENT_ID_LIFECYCLE] = -1;
rv = 0;
@@ -7559,9 +7312,8 @@ remoteDispatchNumOfSecrets(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfSecrets(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -7601,9 +7353,8 @@ remoteDispatchListSecrets(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListSecrets(conn, ret->uuids.uuids_val,
args->maxuuids);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->uuids.uuids_len = len;
rv = 0;
@@ -7634,9 +7385,8 @@ remoteDispatchSecretDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = virSecretDefineXML(conn, args->xml, args->flags);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
make_nonnull_secret(&ret->secret, secret);
rv = 0;
@@ -7669,14 +7419,12 @@ remoteDispatchSecretGetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
value = virSecretGetValue(secret, &value_size, args->flags);
- if (value == NULL) {
+ if (value == NULL)
goto cleanup;
- }
ret->value.value_len = value_size;
ret->value.value_val = (char *)value;
@@ -7709,13 +7457,11 @@ remoteDispatchSecretGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
ret->xml = virSecretGetXMLDesc(secret, args->flags);
- if (ret->xml == NULL) {
+ if (ret->xml == NULL)
goto cleanup;
- }
rv = 0;
@@ -7745,9 +7491,8 @@ remoteDispatchSecretLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = virSecretLookupByUUID(conn, (unsigned char *)args->uuid);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
make_nonnull_secret(&ret->secret, secret);
@@ -7779,13 +7524,11 @@ remoteDispatchSecretSetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
if (virSecretSetValue(secret, (const unsigned char *)args->value.value_val,
- args->value.value_len, args->flags) < 0) {
+ args->value.value_len, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -7815,12 +7558,10 @@ remoteDispatchSecretUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = get_nonnull_secret(conn, args->secret);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
- if (virSecretUndefine(secret) < 0) {
+ if (virSecretUndefine(secret) < 0)
goto cleanup;
- }
rv = 0;
@@ -7850,9 +7591,8 @@ remoteDispatchSecretLookupByUsage(struct qemud_server *server ATTRIBUTE_UNUSED,
}
secret = virSecretLookupByUsage(conn, args->usageType, args->usageID);
- if (secret == NULL) {
+ if (secret == NULL)
goto cleanup;
- }
make_nonnull_secret(&ret->secret, secret);
@@ -7884,15 +7624,13 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
}
domain = get_nonnull_domain(conn, args->dom);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
ret->active = virDomainIsActive(domain);
- if (ret->active < 0) {
+ if (ret->active < 0)
goto cleanup;
- }
rv = 0;
@@ -7921,15 +7659,13 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
}
domain = get_nonnull_domain(conn, args->dom);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
ret->persistent = virDomainIsPersistent(domain);
- if (ret->persistent < 0) {
+ if (ret->persistent < 0)
goto cleanup;
- }
rv = 0;
@@ -7958,15 +7694,13 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
}
domain = get_nonnull_domain(conn, args->dom);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
ret->updated = virDomainIsUpdated(domain);
- if (ret->updated < 0) {
+ if (ret->updated < 0)
goto cleanup;
- }
rv = 0;
@@ -7995,15 +7729,13 @@ static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE
}
iface = get_nonnull_interface(conn, args->iface);
- if (iface == NULL) {
+ if (iface == NULL)
goto cleanup;
- }
ret->active = virInterfaceIsActive(iface);
- if (ret->active < 0) {
+ if (ret->active < 0)
goto cleanup;
- }
rv = 0;
@@ -8032,15 +7764,13 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
}
network = get_nonnull_network(conn, args->net);
- if (network == NULL) {
+ if (network == NULL)
goto cleanup;
- }
ret->active = virNetworkIsActive(network);
- if (ret->active < 0) {
+ if (ret->active < 0)
goto cleanup;
- }
rv = 0;
@@ -8069,15 +7799,13 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
}
network = get_nonnull_network(conn, args->net);
- if (network == NULL) {
+ if (network == NULL)
goto cleanup;
- }
ret->persistent = virNetworkIsPersistent(network);
- if (ret->persistent < 0) {
+ if (ret->persistent < 0)
goto cleanup;
- }
rv = 0;
@@ -8106,15 +7834,13 @@ static int remoteDispatchStoragePoolIsActive(struct qemud_server *server ATTRIBU
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
ret->active = virStoragePoolIsActive(pool);
- if (ret->active < 0) {
+ if (ret->active < 0)
goto cleanup;
- }
rv = 0;
@@ -8143,15 +7869,13 @@ static int remoteDispatchStoragePoolIsPersistent(struct qemud_server *server ATT
}
pool = get_nonnull_storage_pool(conn, args->pool);
- if (pool == NULL) {
+ if (pool == NULL)
goto cleanup;
- }
ret->persistent = virStoragePoolIsPersistent(pool);
- if (ret->persistent < 0) {
+ if (ret->persistent < 0)
goto cleanup;
- }
rv = 0;
@@ -8181,9 +7905,8 @@ static int remoteDispatchIsSecure(struct qemud_server *server ATTRIBUTE_UNUSED,
ret->secure = virConnectIsSecure(conn);
- if (ret->secure < 0) {
+ if (ret->secure < 0)
goto cleanup;
- }
rv = 0;
@@ -8212,9 +7935,8 @@ remoteDispatchCpuCompare(struct qemud_server *server ATTRIBUTE_UNUSED,
}
result = virConnectCompareCPU(conn, args->xml, args->flags);
- if (result == VIR_CPU_COMPARE_ERROR) {
+ if (result == VIR_CPU_COMPARE_ERROR)
goto cleanup;
- }
ret->result = result;
rv = 0;
@@ -8247,9 +7969,8 @@ remoteDispatchCpuBaseline(struct qemud_server *server ATTRIBUTE_UNUSED,
(const char **) args->xmlCPUs.xmlCPUs_val,
args->xmlCPUs.xmlCPUs_len,
args->flags);
- if (cpu == NULL) {
+ if (cpu == NULL)
goto cleanup;
- }
ret->cpu = cpu;
@@ -8281,13 +8002,11 @@ remoteDispatchDomainGetJobInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainGetJobInfo(dom, &info) < 0) {
+ if (virDomainGetJobInfo(dom, &info) < 0)
goto cleanup;
- }
ret->type = info.type;
ret->timeElapsed = info.timeElapsed;
@@ -8331,13 +8050,11 @@ remoteDispatchDomainAbortJob(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainAbortJob(dom) < 0) {
+ if (virDomainAbortJob(dom) < 0)
goto cleanup;
- }
rv = 0;
@@ -8368,13 +8085,11 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) < 0) {
+ if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -8404,13 +8119,11 @@ remoteDispatchDomainMigrateSetMaxSpeed(struct qemud_server *server ATTRIBUTE_UNU
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) < 0) {
+ if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -8441,14 +8154,12 @@ remoteDispatchDomainSnapshotCreateXml(struct qemud_server *server ATTRIBUTE_UNUS
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
snapshot = virDomainSnapshotCreateXML(domain, args->xml_desc, args->flags);
- if (snapshot == NULL) {
+ if (snapshot == NULL)
goto cleanup;
- }
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8525,14 +8236,12 @@ remoteDispatchDomainSnapshotNum(struct qemud_server *server ATTRIBUTE_UNUSED,
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
ret->num = virDomainSnapshotNum(domain, args->flags);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -8569,9 +8278,8 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUS
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->nameslen) < 0) {
@@ -8583,9 +8291,8 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUS
ret->names.names_val,
args->nameslen,
args->flags);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -8619,14 +8326,12 @@ remoteDispatchDomainSnapshotLookupByName(struct qemud_server *server ATTRIBUTE_U
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
snapshot = virDomainSnapshotLookupByName(domain, args->name, args->flags);
- if (snapshot == NULL) {
+ if (snapshot == NULL)
goto cleanup;
- }
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8661,14 +8366,12 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
result = virDomainHasCurrentSnapshot(domain, args->flags);
- if (result < 0) {
+ if (result < 0)
goto cleanup;
- }
ret->result = result;
@@ -8701,14 +8404,12 @@ remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
snapshot = virDomainSnapshotCurrent(domain, args->flags);
- if (snapshot == NULL) {
+ if (snapshot == NULL)
goto cleanup;
- }
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8839,9 +8540,8 @@ remoteDispatchDomainEventsRegisterAny(struct qemud_server *server ATTRIBUTE_UNUS
NULL,
args->eventID,
domainEventCallbacks[args->eventID],
- client, NULL)) < 0) {
+ client, NULL)) < 0)
goto cleanup;
- }
client->domainEventCallbackID[args->eventID] = callbackID;
@@ -8883,9 +8583,8 @@ remoteDispatchDomainEventsDeregisterAny(struct qemud_server *server ATTRIBUTE_UN
goto cleanup;
}
- if (virConnectDomainEventDeregisterAny(conn, callbackID) < 0) {
+ if (virConnectDomainEventDeregisterAny(conn, callbackID) < 0)
goto cleanup;
- }
client->domainEventCallbackID[args->eventID] = -1;
rv = 0;
@@ -8916,9 +8615,8 @@ remoteDispatchNwfilterLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
}
nwfilter = virNWFilterLookupByName(conn, args->name);
- if (nwfilter == NULL) {
+ if (nwfilter == NULL)
goto cleanup;
- }
make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
@@ -8950,9 +8648,8 @@ remoteDispatchNwfilterLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
}
nwfilter = virNWFilterLookupByUUID(conn, (unsigned char *) args->uuid);
- if (nwfilter == NULL) {
+ if (nwfilter == NULL)
goto cleanup;
- }
make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
@@ -8985,9 +8682,8 @@ remoteDispatchNwfilterDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
}
nwfilter = virNWFilterDefineXML(conn, args->xml);
- if (nwfilter == NULL) {
+ if (nwfilter == NULL)
goto cleanup;
- }
make_nonnull_nwfilter(&ret->nwfilter, nwfilter);
@@ -9020,13 +8716,11 @@ remoteDispatchNwfilterUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
}
nwfilter = get_nonnull_nwfilter(conn, args->nwfilter);
- if (nwfilter == NULL) {
+ if (nwfilter == NULL)
goto cleanup;
- }
- if (virNWFilterUndefine(nwfilter) < 0) {
+ if (virNWFilterUndefine(nwfilter) < 0)
goto cleanup;
- }
rv = 0;
@@ -9069,9 +8763,8 @@ remoteDispatchListNwfilters(struct qemud_server *server ATTRIBUTE_UNUSED,
len = virConnectListNWFilters(conn,
ret->names.names_val, args->maxnames);
- if (len < 0) {
+ if (len < 0)
goto cleanup;
- }
ret->names.names_len = len;
rv = 0;
@@ -9103,15 +8796,13 @@ remoteDispatchNwfilterGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
}
nwfilter = get_nonnull_nwfilter(conn, args->nwfilter);
- if (nwfilter == NULL) {
+ if (nwfilter == NULL)
goto cleanup;
- }
/* remoteDispatchClientRequest will free this. */
ret->xml = virNWFilterGetXMLDesc(nwfilter, args->flags);
- if (!ret->xml) {
+ if (!ret->xml)
goto cleanup;
- }
rv = 0;
@@ -9141,9 +8832,8 @@ remoteDispatchNumOfNwfilters(struct qemud_server *server ATTRIBUTE_UNUSED,
}
ret->num = virConnectNumOfNWFilters(conn);
- if (ret->num < 0) {
+ if (ret->num < 0)
goto cleanup;
- }
rv = 0;
@@ -9173,13 +8863,11 @@ remoteDispatchDomainGetBlockInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->dom);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
- if (virDomainGetBlockInfo(dom, args->path, &info, args->flags) < 0) {
+ if (virDomainGetBlockInfo(dom, args->path, &info, args->flags) < 0)
goto cleanup;
- }
ret->capacity = info.capacity;
ret->allocation = info.allocation;
@@ -9213,14 +8901,12 @@ qemuDispatchMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
}
domain = get_nonnull_domain(conn, args->domain);
- if (domain == NULL) {
+ if (domain == NULL)
goto cleanup;
- }
if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
- args->flags) < 0) {
+ args->flags) < 0)
goto cleanup;
- }
rv = 0;
@@ -9253,9 +8939,8 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
}
dom = get_nonnull_domain(conn, args->domain);
- if (dom == NULL) {
+ if (dom == NULL)
goto cleanup;
- }
stream = remoteCreateClientStream(conn, hdr);
if (!stream) {
@@ -9267,13 +8952,11 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
args->devname ? *args->devname : NULL,
stream->st,
args->flags);
- if (r < 0) {
+ if (r < 0)
goto cleanup;
- }
- if (remoteAddClientStream(client, stream, 1) < 0) {
+ if (remoteAddClientStream(client, stream, 1) < 0)
goto cleanup;
- }
rv = 0;
--
1.7.4.2
13 years, 8 months
[libvirt] [PATCH] Change some variable names to follow standard in daemon dispatcher
by Daniel P. Berrange
Replace some occurrances of
virDomainPtr domain;
virNetworkPtr network;
With
virDomainPtr dom;
virNetworkPtr net;
* daemon/remote.c: Fix variable naming to follow standard
---
daemon/remote.c | 194 +++++++++++++++++++++++++++---------------------------
1 files changed, 97 insertions(+), 97 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 66df9f7..eb2727d 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -75,7 +75,7 @@ static virStoragePoolPtr get_nonnull_storage_pool(virConnectPtr conn, remote_non
static virStorageVolPtr get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol);
static virSecretPtr get_nonnull_secret(virConnectPtr conn, remote_nonnull_secret secret);
static virNWFilterPtr get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter);
-static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr domain, remote_nonnull_domain_snapshot snapshot);
+static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr dom, remote_nonnull_domain_snapshot snapshot);
static void make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src);
static void make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src);
static void make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src);
@@ -2198,7 +2198,7 @@ remoteDispatchDomainMigrateFinish(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_migrate_finish_args *args,
remote_domain_migrate_finish_ret *ret)
{
- virDomainPtr ddom = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -2206,21 +2206,21 @@ remoteDispatchDomainMigrateFinish(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (!(ddom = virDomainMigrateFinish(conn, args->dname,
- args->cookie.cookie_val,
- args->cookie.cookie_len,
- args->uri,
- args->flags)))
+ if (!(dom = virDomainMigrateFinish(conn, args->dname,
+ args->cookie.cookie_val,
+ args->cookie.cookie_len,
+ args->uri,
+ args->flags)))
goto cleanup;
- make_nonnull_domain(&ret->ddom, ddom);
+ make_nonnull_domain(&ret->ddom, dom);
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (ddom)
- virDomainFree(ddom);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -2284,7 +2284,7 @@ remoteDispatchDomainMigrateFinish2(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_migrate_finish2_args *args,
remote_domain_migrate_finish2_ret *ret)
{
- virDomainPtr ddom = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -2292,23 +2292,23 @@ remoteDispatchDomainMigrateFinish2(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (!(ddom = virDomainMigrateFinish2(conn, args->dname,
- args->cookie.cookie_val,
- args->cookie.cookie_len,
- args->uri,
- args->flags,
- args->retcode)))
+ if (!(dom = virDomainMigrateFinish2(conn, args->dname,
+ args->cookie.cookie_val,
+ args->cookie.cookie_len,
+ args->uri,
+ args->flags,
+ args->retcode)))
goto cleanup;
- make_nonnull_domain(&ret->ddom, ddom);
+ make_nonnull_domain(&ret->ddom, dom);
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (ddom)
- virDomainFree(ddom);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -7439,7 +7439,7 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
remote_domain_is_active_args *args,
remote_domain_is_active_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -7447,10 +7447,10 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- if ((ret->active = virDomainIsActive(domain)) < 0)
+ if ((ret->active = virDomainIsActive(dom)) < 0)
goto cleanup;
rv = 0;
@@ -7458,8 +7458,8 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -7471,7 +7471,7 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
remote_domain_is_persistent_args *args,
remote_domain_is_persistent_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -7479,10 +7479,10 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- if ((ret->persistent = virDomainIsPersistent(domain)) < 0)
+ if ((ret->persistent = virDomainIsPersistent(dom)) < 0)
goto cleanup;
rv = 0;
@@ -7490,8 +7490,8 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -7503,7 +7503,7 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
remote_domain_is_updated_args *args,
remote_domain_is_updated_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -7511,10 +7511,10 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
- if ((ret->updated = virDomainIsUpdated(domain)) < 0)
+ if ((ret->updated = virDomainIsUpdated(dom)) < 0)
goto cleanup;
rv = 0;
@@ -7522,8 +7522,8 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -7567,7 +7567,7 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
remote_network_is_active_args *args,
remote_network_is_active_ret *ret)
{
- virNetworkPtr network = NULL;
+ virNetworkPtr net = NULL;
int rv = -1;
if (!conn) {
@@ -7575,10 +7575,10 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- if (!(network = get_nonnull_network(conn, args->net)))
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
- if ((ret->active = virNetworkIsActive(network)) < 0)
+ if ((ret->active = virNetworkIsActive(net)) < 0)
goto cleanup;
rv = 0;
@@ -7586,8 +7586,8 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (network)
- virNetworkFree(network);
+ if (net)
+ virNetworkFree(net);
return rv;
}
@@ -7599,7 +7599,7 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
remote_network_is_persistent_args *args,
remote_network_is_persistent_ret *ret)
{
- virNetworkPtr network = NULL;
+ virNetworkPtr net = NULL;
int rv = -1;
if (!conn) {
@@ -7607,10 +7607,10 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
goto cleanup;
}
- if (!(network = get_nonnull_network(conn, args->net)))
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
- if ((ret->persistent = virNetworkIsPersistent(network)) < 0)
+ if ((ret->persistent = virNetworkIsPersistent(net)) < 0)
goto cleanup;
rv = 0;
@@ -7618,8 +7618,8 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (network)
- virNetworkFree(network);
+ if (net)
+ virNetworkFree(net);
return rv;
}
@@ -7937,7 +7937,7 @@ remoteDispatchDomainSnapshotCreateXml(struct qemud_server *server ATTRIBUTE_UNUS
remote_domain_snapshot_create_xml_ret *ret)
{
virDomainSnapshotPtr snapshot;
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -7945,10 +7945,10 @@ remoteDispatchDomainSnapshotCreateXml(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- if (!(snapshot = virDomainSnapshotCreateXML(domain, args->xml_desc, args->flags)))
+ if (!(snapshot = virDomainSnapshotCreateXML(dom, args->xml_desc, args->flags)))
goto cleanup;
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -7960,8 +7960,8 @@ cleanup:
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -7974,7 +7974,7 @@ remoteDispatchDomainSnapshotDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED
remote_domain_snapshot_dump_xml_args *args,
remote_domain_snapshot_dump_xml_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
int rv = -1;
@@ -7983,10 +7983,10 @@ remoteDispatchDomainSnapshotDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->snap.domain)))
+ if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
- if (!(snapshot = get_nonnull_domain_snapshot(domain, args->snap)))
+ if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
/* remoteDispatchClientRequest will free this. */
@@ -8000,8 +8000,8 @@ cleanup:
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8014,7 +8014,7 @@ remoteDispatchDomainSnapshotNum(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_snapshot_num_args *args,
remote_domain_snapshot_num_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -8022,10 +8022,10 @@ remoteDispatchDomainSnapshotNum(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- if ((ret->num = virDomainSnapshotNum(domain, args->flags)) < 0)
+ if ((ret->num = virDomainSnapshotNum(dom, args->flags)) < 0)
goto cleanup;
rv = 0;
@@ -8033,8 +8033,8 @@ remoteDispatchDomainSnapshotNum(struct qemud_server *server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8047,7 +8047,7 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUS
remote_domain_snapshot_list_names_args *args,
remote_domain_snapshot_list_names_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
int len;
@@ -8062,7 +8062,7 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
/* Allocate return buffer. */
@@ -8071,7 +8071,7 @@ remoteDispatchDomainSnapshotListNames(struct qemud_server *server ATTRIBUTE_UNUS
goto cleanup;
}
- len = virDomainSnapshotListNames(domain,
+ len = virDomainSnapshotListNames(dom,
ret->names.names_val,
args->nameslen,
args->flags);
@@ -8086,8 +8086,8 @@ cleanup:
remoteDispatchError(rerr);
VIR_FREE(ret->names.names_val);
}
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8101,7 +8101,7 @@ remoteDispatchDomainSnapshotLookupByName(struct qemud_server *server ATTRIBUTE_U
remote_domain_snapshot_lookup_by_name_ret *ret)
{
virDomainSnapshotPtr snapshot;
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -8109,10 +8109,10 @@ remoteDispatchDomainSnapshotLookupByName(struct qemud_server *server ATTRIBUTE_U
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- if (!(snapshot = virDomainSnapshotLookupByName(domain, args->name, args->flags)))
+ if (!(snapshot = virDomainSnapshotLookupByName(dom, args->name, args->flags)))
goto cleanup;
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8124,8 +8124,8 @@ cleanup:
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8138,7 +8138,7 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
remote_domain_has_current_snapshot_args *args,
remote_domain_has_current_snapshot_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int result;
int rv = -1;
@@ -8147,10 +8147,10 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- result = virDomainHasCurrentSnapshot(domain, args->flags);
+ result = virDomainHasCurrentSnapshot(dom, args->flags);
if (result < 0)
goto cleanup;
@@ -8161,8 +8161,8 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8176,7 +8176,7 @@ remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED
remote_domain_snapshot_current_ret *ret)
{
virDomainSnapshotPtr snapshot;
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -8184,10 +8184,10 @@ remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- if (!(snapshot = virDomainSnapshotCurrent(domain, args->flags)))
+ if (!(snapshot = virDomainSnapshotCurrent(dom, args->flags)))
goto cleanup;
make_nonnull_domain_snapshot(&ret->snap, snapshot);
@@ -8199,8 +8199,8 @@ cleanup:
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8213,7 +8213,7 @@ remoteDispatchDomainRevertToSnapshot(struct qemud_server *server ATTRIBUTE_UNUSE
remote_domain_revert_to_snapshot_args *args,
void *ret ATTRIBUTE_UNUSED)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
int rv = -1;
@@ -8222,10 +8222,10 @@ remoteDispatchDomainRevertToSnapshot(struct qemud_server *server ATTRIBUTE_UNUSE
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->snap.domain)))
+ if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
- if (!(snapshot = get_nonnull_domain_snapshot(domain, args->snap)))
+ if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
if (virDomainRevertToSnapshot(snapshot, args->flags) < 0)
@@ -8238,8 +8238,8 @@ cleanup:
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8252,7 +8252,7 @@ remoteDispatchDomainSnapshotDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
remote_domain_snapshot_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
int rv = -1;
@@ -8261,10 +8261,10 @@ remoteDispatchDomainSnapshotDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->snap.domain)))
+ if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
- if (!(snapshot = get_nonnull_domain_snapshot(domain, args->snap)))
+ if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
if (virDomainSnapshotDelete(snapshot, args->flags) < 0)
@@ -8277,8 +8277,8 @@ cleanup:
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8658,7 +8658,7 @@ qemuDispatchMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
qemu_monitor_command_args *args,
qemu_monitor_command_ret *ret)
{
- virDomainPtr domain = NULL;
+ virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
@@ -8666,10 +8666,10 @@ qemuDispatchMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (!(domain = get_nonnull_domain(conn, args->domain)))
+ if (!(dom = get_nonnull_domain(conn, args->domain)))
goto cleanup;
- if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
+ if (virDomainQemuMonitorCommand(dom, args->cmd, &ret->result,
args->flags) < 0)
goto cleanup;
@@ -8678,8 +8678,8 @@ qemuDispatchMonitorCommand(struct qemud_server *server ATTRIBUTE_UNUSED,
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
- if (domain)
- virDomainFree(domain);
+ if (dom)
+ virDomainFree(dom);
return rv;
}
@@ -8793,9 +8793,9 @@ get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter)
}
static virDomainSnapshotPtr
-get_nonnull_domain_snapshot(virDomainPtr domain, remote_nonnull_domain_snapshot snapshot)
+get_nonnull_domain_snapshot(virDomainPtr dom, remote_nonnull_domain_snapshot snapshot)
{
- return virGetDomainSnapshot(domain, snapshot.name);
+ return virGetDomainSnapshot(dom, snapshot.name);
}
/* Make remote_nonnull_domain and remote_nonnull_network. */
--
1.7.4.2
13 years, 8 months
[libvirt] [PATCH] Remove C99 variable declare in PHYP network driver
by Daniel P. Berrange
Move the virInterfacePtr declaration to the top of the
function to avoid jump uninitialized variable warnings
* src/phyp/phyp_driver.c: Fix var declaration
---
src/phyp/phyp_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
Pushed to fix the broken build...
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index b5145db..a1b6819 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3587,6 +3587,7 @@ phypInterfaceLookupByName(virConnectPtr conn, const char *name)
int slot = 0;
int lpar_id = 0;
char mac[PHYP_MAC_SIZE];
+ virInterfacePtr result = NULL;
/*Getting the slot number for the interface */
virBufferAddLit(&buf, "lshwres ");
@@ -3667,7 +3668,7 @@ phypInterfaceLookupByName(virConnectPtr conn, const char *name)
memcpy(mac, ret, PHYP_MAC_SIZE-1);
- virInterfacePtr result = virGetInterface(conn, name, ret);
+ result = virGetInterface(conn, name, ret);
VIR_FREE(cmd);
VIR_FREE(ret);
--
1.7.4.2
13 years, 8 months
[libvirt] [BUG] qemu quited unexpectedly will cause libvirtd crashed
by Wen Congyang
When I edit the domain's config file like this:
=====================
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/test3.img'/>
<target dev='sdb' bus='scsi'/>
<address type='drive' controller='0' bus='0' unit='10'/>
</disk>
=====================
Note, the unit is wrong, but libvirt does not check it.
When I start the vm with the wrong config file, libvirtd will be blocked because
qemu quited unexpectedly. This bug does not happen every time, and it only happened
once on my box.
So I try to use gdb and add sleep() to trigger this bug. I have posted two patches
to fix 2 bugs. But there is still another bug, and I have no good way to fix it.
I add sleep() in qemuDomainObjExitMonitorWithDriver():
==============================
int qemuDomainObjExitMonitorWithDriver(struct qemud_driver *driver,
virDomainObjPtr obj)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
int refs;
int debug = 0;
refs = qemuMonitorUnref(priv->mon);
if (refs > 0)
qemuMonitorUnlock(priv->mon);
/* Note: qemu may quited unexpectedly here, and the monitor will be freed.
* If it happened, priv->mon will be null.
*/
if (debug)
sleep(100);
qemuDriverLock(driver);
virDomainObjLock(obj);
if (refs == 0) {
priv->mon = NULL;
}
}
==============================
Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
qemuConnectMonitor()
2. start a vm
3. let the libvirtd to run until qemuMonitorSetCapabilities() returns.
4. kill the qemu process
5. step into qemuDomainObjExitMonitorWithDriver(), and set debug to 1
Now, qemuDomainObjExitMonitorWithDriver() will sleep 100s to make sure
qemuProcessHandleMonitorEOF() is done before qemuProcessHandleMonitorEOF()
returns.
priv->mon will be null after qemuDomainObjExitMonitorWithDriver() returns.
So we must not use it. Unfortunately we still use it, and it will cause
libvirtd crashed.
My first fix is that qemuDomainObjExitMonitorWithDriver() returns -1, and
the caller checks the return value, then do some cleanup and return error.
Unfortunately we may use priv->mon when doing some cleanup. The only way
to avoid it is that add some local variable and set it when qemu quited
unexpectedly. Avoid to use priv->mon in cleanup codes
Is there some simply way to fix this bug.
13 years, 8 months
[libvirt] [PATCH] Make error reporting in libvirtd thread safe
by Jiri Denemark
Bug https://bugzilla.redhat.com/show_bug.cgi?id=689374 reported libvirtd
crash during error dispatch.
The reason is that libvirtd uses remoteDispatchConnError() with non-NULL
conn parameter which means that virConnGetLastError() is used instead of
its thread safe replacement virGetLastError().
So when several libvirtd threads are reporting errors at the same time,
the errors can get mixed or corrupted or in case of bad luck libvirtd
itself crashes.
Since Daniel B. is going to rewrite this code from scratch on top of his
RPC infrastructure, I tried to come up with a minimal fix. Thus,
remoteDispatchConnError() now just ignores its conn argument and always
calls virGetLastError(). However, several callers had to be touched as
well, since no libvirt API is allowed to be called before dispatching
the error. Doing so would reset the error and we would have nothing to
dispatch. As a result of that, the code is not very nice but that
doesn't really make daemon/remote.c worse than it is now :-) And it will
all die soon, which is good.
The bug report also contains a reproducer in C which detects both mixed
up error messages and libvirtd crash. Before this patch, I was able to
crash libvirtd in about 20 seconds up to 3 minutes depending on number
of CPU cores (more is better) and luck.
---
daemon/dispatch.c | 8 +--
daemon/remote.c | 238 +++++++++++++++++++++++++++-------------------------
2 files changed, 126 insertions(+), 120 deletions(-)
diff --git a/daemon/dispatch.c b/daemon/dispatch.c
index dc3b48a..4814017 100644
--- a/daemon/dispatch.c
+++ b/daemon/dispatch.c
@@ -113,14 +113,10 @@ void remoteDispatchOOMError (remote_error *rerr)
void remoteDispatchConnError (remote_error *rerr,
- virConnectPtr conn)
+ virConnectPtr conn ATTRIBUTE_UNUSED)
{
- virErrorPtr verr;
+ virErrorPtr verr = virGetLastError();
- if (conn)
- verr = virConnGetLastError(conn);
- else
- verr = virGetLastError();
if (verr)
remoteDispatchCopyError(rerr, verr);
else
diff --git a/daemon/remote.c b/daemon/remote.c
index a8fef4d..4b42ed2 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -757,8 +757,8 @@ remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUS
type = virDomainGetSchedulerType (dom, &nparams);
if (type == NULL) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -801,9 +801,9 @@ remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUT
r = virDomainGetSchedulerParameters (dom, params, &nparams);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
VIR_FREE(params);
- remoteDispatchConnError(rerr, conn);
return -1;
}
@@ -908,12 +908,13 @@ remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUT
}
r = virDomainSetSchedulerParameters (dom, params, nparams);
- virDomainFree(dom);
VIR_FREE(params);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
+ virDomainFree(dom);
return 0;
}
@@ -939,8 +940,8 @@ remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED,
path = args->path;
if (virDomainBlockStats (dom, path, &stats, sizeof stats) == -1) {
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -975,8 +976,8 @@ remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED
path = args->path;
if (virDomainInterfaceStats (dom, path, &stats, sizeof stats) == -1) {
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -1026,12 +1027,13 @@ remoteDispatchDomainMemoryStats (struct qemud_server *server ATTRIBUTE_UNUSED,
}
nr_stats = virDomainMemoryStats (dom, stats, args->maxStats, 0);
- virDomainFree (dom);
if (nr_stats == -1) {
VIR_FREE(stats);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
+ virDomainFree (dom);
/* Allocate return buffer */
if (VIR_ALLOC_N(ret->stats.stats_val, args->maxStats) < 0) {
@@ -1092,8 +1094,8 @@ remoteDispatchDomainBlockPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainBlockPeek (dom, path, offset, size,
ret->buffer.buffer_val, flags) == -1) {
/* free (ret->buffer.buffer_val); - caller frees */
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -1141,8 +1143,8 @@ remoteDispatchDomainMemoryPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainMemoryPeek (dom, offset, size,
ret->buffer.buffer_val, flags) == -1) {
/* free (ret->buffer.buffer_val); - caller frees */
- virDomainFree (dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
virDomainFree (dom);
@@ -1168,8 +1170,8 @@ remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainAttachDevice (dom, args->xml) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1194,8 +1196,8 @@ remoteDispatchDomainAttachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainAttachDeviceFlags (dom, args->xml, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1220,8 +1222,8 @@ remoteDispatchDomainUpdateDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainUpdateDeviceFlags (dom, args->xml, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1246,8 +1248,8 @@ remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainCreate (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1272,8 +1274,8 @@ remoteDispatchDomainCreateWithFlags (struct qemud_server *server ATTRIBUTE_UNUSE
}
if (virDomainCreateWithFlags (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1346,8 +1348,8 @@ remoteDispatchDomainDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainDestroy (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1372,8 +1374,8 @@ remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainDetachDevice (dom, args->xml) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1399,8 +1401,8 @@ remoteDispatchDomainDetachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainDetachDeviceFlags (dom, args->xml, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1428,8 +1430,8 @@ remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virDomainGetXMLDesc (dom, args->flags);
if (!ret->xml) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1497,8 +1499,8 @@ remoteDispatchDomainGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetAutostart (dom, &ret->autostart) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1524,8 +1526,8 @@ remoteDispatchDomainGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetInfo (dom, &info) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1559,8 +1561,8 @@ remoteDispatchDomainGetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->memory = virDomainGetMaxMemory (dom);
if (ret->memory == 0) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1586,8 +1588,8 @@ remoteDispatchDomainGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virDomainGetMaxVcpus (dom);
if (ret->num == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1614,8 +1616,8 @@ remoteDispatchDomainGetSecurityLabel(struct qemud_server *server ATTRIBUTE_UNUSE
memset(&seclabel, 0, sizeof seclabel);
if (virDomainGetSecurityLabel(dom, &seclabel) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -1686,8 +1688,8 @@ remoteDispatchDomainGetOsType (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this */
ret->type = virDomainGetOSType (dom);
if (ret->type == NULL) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1737,10 +1739,10 @@ remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
info, args->maxinfo,
cpumaps, args->maplen);
if (info_len == -1) {
+ remoteDispatchConnError(rerr, conn);
VIR_FREE(info);
VIR_FREE(cpumaps);
virDomainFree(dom);
- remoteDispatchConnError(rerr, conn);
return -1;
}
@@ -1794,8 +1796,8 @@ remoteDispatchDomainGetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virDomainGetVcpusFlags (dom, args->flags);
if (ret->num == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -1877,11 +1879,12 @@ remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED
args->cookie.cookie_len,
args->uri,
args->flags, dname, args->resource);
- virDomainFree (dom);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree (dom);
return -1;
}
+ virDomainFree (dom);
return 0;
}
@@ -2013,8 +2016,8 @@ remoteDispatchDomainMigratePrepareTunnel(struct qemud_server *server ATTRIBUTE_U
args->flags, dname, args->resource,
args->dom_xml);
if (r == -1) {
- remoteFreeClientStream(client, stream);
remoteDispatchConnError(rerr, conn);
+ remoteFreeClientStream(client, stream);
return -1;
}
@@ -2175,8 +2178,8 @@ remoteDispatchDomainPinVcpu (struct qemud_server *server ATTRIBUTE_UNUSED,
(unsigned char *) args->cpumap.cpumap_val,
args->cpumap.cpumap_len);
if (rv == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2201,8 +2204,8 @@ remoteDispatchDomainReboot (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainReboot (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2245,8 +2248,8 @@ remoteDispatchDomainResume (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainResume (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2271,8 +2274,8 @@ remoteDispatchDomainSave (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSave (dom, args->to) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2297,8 +2300,8 @@ remoteDispatchDomainCoreDump (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainCoreDump (dom, args->to, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2323,8 +2326,8 @@ remoteDispatchDomainSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetAutostart (dom, args->autostart) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2349,8 +2352,8 @@ remoteDispatchDomainSetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetMaxMemory (dom, args->memory) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2375,8 +2378,8 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetMemory (dom, args->memory) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2401,8 +2404,8 @@ remoteDispatchDomainSetMemoryFlags (struct qemud_server *server ATTRIBUTE_UNUSED
}
if (virDomainSetMemoryFlags (dom, args->memory, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2491,12 +2494,13 @@ remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
}
r = virDomainSetMemoryParameters(dom, params, nparams, flags);
- virDomainFree(dom);
VIR_FREE(params);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
+ virDomainFree(dom);
return 0;
}
@@ -2541,9 +2545,9 @@ remoteDispatchDomainGetMemoryParameters(struct qemud_server *server
r = virDomainGetMemoryParameters(dom, params, &nparams, flags);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
VIR_FREE(params);
- remoteDispatchConnError(rerr, conn);
return -1;
}
/* In this case, we need to send back the number of parameters
@@ -2701,12 +2705,13 @@ remoteDispatchDomainSetBlkioParameters(struct qemud_server *server
}
r = virDomainSetBlkioParameters(dom, params, nparams, flags);
- virDomainFree(dom);
VIR_FREE(params);
if (r == -1) {
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
+ virDomainFree(dom);
return 0;
}
@@ -2751,9 +2756,9 @@ remoteDispatchDomainGetBlkioParameters(struct qemud_server *server
r = virDomainGetBlkioParameters(dom, params, &nparams, flags);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
VIR_FREE(params);
- remoteDispatchConnError(rerr, conn);
return -1;
}
/* In this case, we need to send back the number of parameters
@@ -2847,8 +2852,8 @@ remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetVcpus (dom, args->nvcpus) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2873,8 +2878,8 @@ remoteDispatchDomainSetVcpusFlags (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSetVcpusFlags (dom, args->nvcpus, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2899,8 +2904,8 @@ remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainShutdown (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2925,8 +2930,8 @@ remoteDispatchDomainSuspend (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainSuspend (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -2951,8 +2956,8 @@ remoteDispatchDomainUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainUndefine (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -3044,8 +3049,8 @@ remoteDispatchDomainManagedSave (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainManagedSave (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -3071,8 +3076,8 @@ remoteDispatchDomainHasManagedSaveImage (struct qemud_server *server ATTRIBUTE_U
ret->ret = virDomainHasManagedSaveImage (dom, args->flags);
if (ret->ret == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -3097,8 +3102,8 @@ remoteDispatchDomainManagedSaveRemove (struct qemud_server *server ATTRIBUTE_UNU
}
if (virDomainManagedSaveRemove (dom, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
virDomainFree(dom);
@@ -3157,8 +3162,8 @@ remoteDispatchNetworkCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkCreate (net) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3227,8 +3232,8 @@ remoteDispatchNetworkDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkDestroy (net) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3255,8 +3260,8 @@ remoteDispatchNetworkDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virNetworkGetXMLDesc (net, args->flags);
if (!ret->xml) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3281,8 +3286,8 @@ remoteDispatchNetworkGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkGetAutostart (net, &ret->autostart) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3309,8 +3314,8 @@ remoteDispatchNetworkGetBridgeName (struct qemud_server *server ATTRIBUTE_UNUSED
/* remoteDispatchClientRequest will free this. */
ret->name = virNetworkGetBridgeName (net);
if (!ret->name) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3379,8 +3384,8 @@ remoteDispatchNetworkSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkSetAutostart (net, args->autostart) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3405,8 +3410,8 @@ remoteDispatchNetworkUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNetworkUndefine (net) == -1) {
- virNetworkFree(net);
remoteDispatchConnError(rerr, conn);
+ virNetworkFree(net);
return -1;
}
virNetworkFree(net);
@@ -3642,8 +3647,8 @@ remoteDispatchInterfaceGetXmlDesc (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virInterfaceGetXMLDesc (iface, args->flags);
if (!ret->xml) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -3690,8 +3695,8 @@ remoteDispatchInterfaceUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virInterfaceUndefine (iface) == -1) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -3716,8 +3721,8 @@ remoteDispatchInterfaceCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virInterfaceCreate (iface, args->flags) == -1) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -3742,8 +3747,8 @@ remoteDispatchInterfaceDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virInterfaceDestroy (iface, args->flags) == -1) {
- virInterfaceFree(iface);
remoteDispatchConnError(rerr, conn);
+ virInterfaceFree(iface);
return -1;
}
virInterfaceFree(iface);
@@ -4656,8 +4661,8 @@ remoteDispatchStoragePoolCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolCreate (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4726,8 +4731,8 @@ remoteDispatchStoragePoolBuild (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolBuild (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4753,8 +4758,8 @@ remoteDispatchStoragePoolDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolDestroy (pool) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4779,8 +4784,8 @@ remoteDispatchStoragePoolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolDelete (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4805,8 +4810,8 @@ remoteDispatchStoragePoolRefresh (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolRefresh (pool, args->flags) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4832,8 +4837,8 @@ remoteDispatchStoragePoolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolGetInfo (pool, &info) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
@@ -4867,8 +4872,8 @@ remoteDispatchStoragePoolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virStoragePoolGetXMLDesc (pool, args->flags);
if (!ret->xml) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4893,8 +4898,8 @@ remoteDispatchStoragePoolGetAutostart (struct qemud_server *server ATTRIBUTE_UNU
}
if (virStoragePoolGetAutostart (pool, &ret->autostart) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -4965,11 +4970,12 @@ remoteDispatchStoragePoolLookupByVolume (struct qemud_server *server ATTRIBUTE_U
}
pool = virStoragePoolLookupByVolume (vol);
- virStorageVolFree(vol);
if (pool == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
+ virStorageVolFree(vol);
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -4994,8 +5000,8 @@ remoteDispatchStoragePoolSetAutostart (struct qemud_server *server ATTRIBUTE_UNU
}
if (virStoragePoolSetAutostart (pool, args->autostart) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -5020,8 +5026,8 @@ remoteDispatchStoragePoolUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStoragePoolUndefine (pool) == -1) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
virStoragePoolFree(pool);
@@ -5163,11 +5169,12 @@ remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
}
vol = virStorageVolCreateXML (pool, args->xml, args->flags);
- virStoragePoolFree(pool);
if (vol == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
+ virStoragePoolFree(pool);
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -5194,19 +5201,21 @@ remoteDispatchStorageVolCreateXmlFrom (struct qemud_server *server ATTRIBUTE_UNU
clonevol = get_nonnull_storage_vol (conn, args->clonevol);
if (clonevol == NULL) {
- virStoragePoolFree(pool);
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
newvol = virStorageVolCreateXMLFrom (pool, args->xml, clonevol,
args->flags);
- virStorageVolFree(clonevol);
- virStoragePoolFree(pool);
if (newvol == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(clonevol);
+ virStoragePoolFree(pool);
return -1;
}
+ virStorageVolFree(clonevol);
+ virStoragePoolFree(pool);
make_nonnull_storage_vol (&ret->vol, newvol);
virStorageVolFree(newvol);
@@ -5231,8 +5240,8 @@ remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStorageVolDelete (vol, args->flags) == -1) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
virStorageVolFree(vol);
@@ -5290,8 +5299,8 @@ remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virStorageVolGetInfo (vol, &info) == -1) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
@@ -5324,8 +5333,8 @@ remoteDispatchStorageVolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virStorageVolGetXMLDesc (vol, args->flags);
if (!ret->xml) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
virStorageVolFree(vol);
@@ -5353,8 +5362,8 @@ remoteDispatchStorageVolGetPath (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->name = virStorageVolGetPath (vol);
if (!ret->name) {
- virStorageVolFree(vol);
remoteDispatchConnError(rerr, conn);
+ virStorageVolFree(vol);
return -1;
}
virStorageVolFree(vol);
@@ -5381,11 +5390,12 @@ remoteDispatchStorageVolLookupByName (struct qemud_server *server ATTRIBUTE_UNUS
}
vol = virStorageVolLookupByName (pool, args->name);
- virStoragePoolFree(pool);
if (vol == NULL) {
remoteDispatchConnError(rerr, conn);
+ virStoragePoolFree(pool);
return -1;
}
+ virStoragePoolFree(pool);
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -5622,8 +5632,8 @@ remoteDispatchNodeDeviceNumOfCaps (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virNodeDeviceNumOfCaps(dev);
if (ret->num < 0) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5668,8 +5678,8 @@ remoteDispatchNodeDeviceListCaps (struct qemud_server *server ATTRIBUTE_UNUSED,
virNodeDeviceListCaps (dev, ret->names.names_val,
args->maxnames);
if (ret->names.names_len == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
VIR_FREE(ret->names.names_val);
return -1;
}
@@ -5698,8 +5708,8 @@ remoteDispatchNodeDeviceDettach (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceDettach(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5727,8 +5737,8 @@ remoteDispatchNodeDeviceReAttach (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceReAttach(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5756,8 +5766,8 @@ remoteDispatchNodeDeviceReset (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceReset(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -5808,8 +5818,8 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNodeDeviceDestroy(dev) == -1) {
- virNodeDeviceFree(dev);
remoteDispatchConnError(rerr, conn);
+ virNodeDeviceFree(dev);
return -1;
}
@@ -6189,8 +6199,8 @@ static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UN
ret->active = virDomainIsActive(domain);
if (ret->active < 0) {
- virDomainFree(domain);
remoteDispatchConnError(err, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6217,8 +6227,8 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT
ret->persistent = virDomainIsPersistent(domain);
if (ret->persistent < 0) {
- virDomainFree(domain);
remoteDispatchConnError(err, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6245,8 +6255,8 @@ static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_U
ret->updated = virDomainIsUpdated(domain);
if (ret->updated < 0) {
- virDomainFree(domain);
remoteDispatchConnError(err, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6273,8 +6283,8 @@ static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE
ret->active = virInterfaceIsActive(iface);
if (ret->active < 0) {
- virInterfaceFree(iface);
remoteDispatchConnError(err, conn);
+ virInterfaceFree(iface);
return -1;
}
@@ -6301,8 +6311,8 @@ static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_U
ret->active = virNetworkIsActive(network);
if (ret->active < 0) {
- virNetworkFree(network);
remoteDispatchConnError(err, conn);
+ virNetworkFree(network);
return -1;
}
@@ -6329,8 +6339,8 @@ static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBU
ret->persistent = virNetworkIsPersistent(network);
if (ret->persistent < 0) {
- virNetworkFree(network);
remoteDispatchConnError(err, conn);
+ virNetworkFree(network);
return -1;
}
@@ -6357,8 +6367,8 @@ static int remoteDispatchStoragePoolIsActive(struct qemud_server *server ATTRIBU
ret->active = virStoragePoolIsActive(pool);
if (ret->active < 0) {
- virStoragePoolFree(pool);
remoteDispatchConnError(err, conn);
+ virStoragePoolFree(pool);
return -1;
}
@@ -6385,8 +6395,8 @@ static int remoteDispatchStoragePoolIsPersistent(struct qemud_server *server ATT
ret->persistent = virStoragePoolIsPersistent(pool);
if (ret->persistent < 0) {
- virStoragePoolFree(pool);
remoteDispatchConnError(err, conn);
+ virStoragePoolFree(pool);
return -1;
}
@@ -6481,8 +6491,8 @@ remoteDispatchDomainGetJobInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetJobInfo (dom, &info) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -6523,8 +6533,8 @@ remoteDispatchDomainAbortJob (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainAbortJob (dom) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -6552,8 +6562,8 @@ remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_
}
if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -6610,8 +6620,8 @@ remoteDispatchDomainSnapshotCreateXml (struct qemud_server *server ATTRIBUTE_UNU
snapshot = virDomainSnapshotCreateXML(domain, args->xml_desc, args->flags);
if (snapshot == NULL) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6652,12 +6662,12 @@ remoteDispatchDomainSnapshotDumpXml (struct qemud_server *server ATTRIBUTE_UNUSE
rc = 0;
cleanup:
+ if (rc < 0)
+ remoteDispatchConnError(rerr, conn);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (domain)
virDomainFree(domain);
- if (rc < 0)
- remoteDispatchConnError(rerr, conn);
return rc;
}
@@ -6681,8 +6691,8 @@ remoteDispatchDomainSnapshotNum (struct qemud_server *server ATTRIBUTE_UNUSED,
ret->num = virDomainSnapshotNum(domain, args->flags);
if (ret->num == -1) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6726,9 +6736,9 @@ remoteDispatchDomainSnapshotListNames (struct qemud_server *server ATTRIBUTE_UNU
args->nameslen,
args->flags);
if (ret->names.names_len == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(domain);
VIR_FREE(ret->names.names_val);
- remoteDispatchConnError(rerr, conn);
return -1;
}
@@ -6757,8 +6767,8 @@ remoteDispatchDomainSnapshotLookupByName (struct qemud_server *server ATTRIBUTE_
snapshot = virDomainSnapshotLookupByName(domain, args->name, args->flags);
if (snapshot == NULL) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6790,8 +6800,8 @@ remoteDispatchDomainHasCurrentSnapshot(struct qemud_server *server ATTRIBUTE_UNU
result = virDomainHasCurrentSnapshot(domain, args->flags);
if (result < 0) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6822,8 +6832,8 @@ remoteDispatchDomainSnapshotCurrent(struct qemud_server *server ATTRIBUTE_UNUSED
snapshot = virDomainSnapshotCurrent(domain, args->flags);
if (snapshot == NULL) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -6862,12 +6872,12 @@ remoteDispatchDomainRevertToSnapshot (struct qemud_server *server ATTRIBUTE_UNUS
rc = 0;
cleanup:
+ if (rc < 0)
+ remoteDispatchConnError(rerr, conn);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (domain)
virDomainFree(domain);
- if (rc < 0)
- remoteDispatchConnError(rerr, conn);
return rc;
}
@@ -6899,12 +6909,12 @@ remoteDispatchDomainSnapshotDelete (struct qemud_server *server ATTRIBUTE_UNUSED
rc = 0;
cleanup:
+ if (rc < 0)
+ remoteDispatchConnError(rerr, conn);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (domain)
virDomainFree(domain);
- if (rc < 0)
- remoteDispatchConnError(rerr, conn);
return rc;
}
@@ -7069,8 +7079,8 @@ remoteDispatchNwfilterUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virNWFilterUndefine (nwfilter) == -1) {
- virNWFilterFree(nwfilter);
remoteDispatchConnError(rerr, conn);
+ virNWFilterFree(nwfilter);
return -1;
}
virNWFilterFree(nwfilter);
@@ -7132,8 +7142,8 @@ remoteDispatchNwfilterGetXmlDesc (struct qemud_server *server ATTRIBUTE_UNUSED,
/* remoteDispatchClientRequest will free this. */
ret->xml = virNWFilterGetXMLDesc (nwfilter, args->flags);
if (!ret->xml) {
- virNWFilterFree(nwfilter);
remoteDispatchConnError(rerr, conn);
+ virNWFilterFree(nwfilter);
return -1;
}
virNWFilterFree(nwfilter);
@@ -7180,8 +7190,8 @@ remoteDispatchDomainGetBlockInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
}
if (virDomainGetBlockInfo (dom, args->path, &info, args->flags) == -1) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
return -1;
}
@@ -7213,8 +7223,8 @@ qemuDispatchMonitorCommand (struct qemud_server *server ATTRIBUTE_UNUSED,
if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
args->flags) == -1) {
- virDomainFree(domain);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(domain);
return -1;
}
@@ -7257,15 +7267,15 @@ remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
stream->st,
args->flags);
if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
virDomainFree(dom);
remoteFreeClientStream(client, stream);
- remoteDispatchConnError(rerr, conn);
return -1;
}
if (remoteAddClientStream(client, stream, 1) < 0) {
- virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
+ virDomainFree(dom);
virStreamAbort(stream->st);
remoteFreeClientStream(client, stream);
return -1;
--
1.7.4.1
13 years, 8 months