mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: remove unneeded cleanup labels
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f4db846c32
commit
6c63adc4a0
@ -1076,7 +1076,6 @@ qemuSetupCgroup(virDomainObjPtr vm,
|
||||
int *nicindexes)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (!vm->pid) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -1091,23 +1090,21 @@ qemuSetupCgroup(virDomainObjPtr vm,
|
||||
return 0;
|
||||
|
||||
if (qemuSetupDevicesCgroup(vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuSetupBlkioCgroup(vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuSetupMemoryCgroup(vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuSetupCpuCgroup(vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuSetupCpusetCgroup(vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2293,7 +2293,6 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
|
||||
{
|
||||
g_auto(virBuffer) tmp = VIR_BUFFER_INIT_CHILD(buf);
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||
int ret = -1;
|
||||
|
||||
if (src->nodestorage || src->nodeformat) {
|
||||
virBufferAddLit(buf, "<nodenames>\n");
|
||||
@ -2308,7 +2307,7 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
|
||||
virBufferAsprintf(buf, "<reservations mgralias='%s'/>\n", src->pr->mgralias);
|
||||
|
||||
if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (srcPriv) {
|
||||
qemuStorageSourcePrivateDataFormatSecinfo(&tmp, srcPriv->secinfo, "auth");
|
||||
@ -2320,10 +2319,7 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
|
||||
|
||||
virXMLFormatElement(buf, "objects", NULL, &tmp);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -2598,7 +2594,6 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf,
|
||||
{
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
int ret = -1;
|
||||
|
||||
virBufferAsprintf(&attrBuf, " type='%s' format='%s'",
|
||||
virStorageTypeToString(src->type),
|
||||
@ -2606,14 +2601,11 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf,
|
||||
|
||||
if (virDomainDiskSourceFormat(&childBuf, src, "source", 0, false,
|
||||
VIR_DOMAIN_DEF_FORMAT_STATUS, xmlopt) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virXMLFormatElement(buf, "migrationSource", &attrBuf, &childBuf);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -2625,7 +2617,6 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
|
||||
size_t i;
|
||||
virDomainDiskDefPtr disk;
|
||||
qemuDomainDiskPrivatePtr diskPriv;
|
||||
int ret = -1;
|
||||
|
||||
for (i = 0; i < vm->def->ndisks; i++) {
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
@ -2640,15 +2631,12 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
|
||||
qemuDomainObjPrivateXMLFormatNBDMigrationSource(&childBuf,
|
||||
diskPriv->migrSource,
|
||||
priv->driver->xmlopt) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
virXMLFormatElement(buf, "disk", &attrBuf, &childBuf);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -2660,7 +2648,6 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
|
||||
g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
|
||||
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||
qemuDomainJob job = priv->job.active;
|
||||
int ret = -1;
|
||||
|
||||
if (!qemuDomainTrackJob(job))
|
||||
job = QEMU_JOB_NONE;
|
||||
@ -2684,17 +2671,14 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
|
||||
|
||||
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT &&
|
||||
qemuDomainObjPrivateXMLFormatNBDMigration(&childBuf, vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (priv->job.migParams)
|
||||
qemuMigrationParamsFormat(&childBuf, priv->job.migParams);
|
||||
|
||||
virXMLFormatElement(buf, "job", &attrBuf, &childBuf);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -4013,11 +3997,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
bool addDefaultUSBKBD = false;
|
||||
bool addDefaultUSBMouse = false;
|
||||
bool addPanicDevice = false;
|
||||
int ret = -1;
|
||||
|
||||
/* add implicit input devices */
|
||||
if (qemuDomainDefAddImplicitInputDevice(def) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* Add implicit PCI root controller if the machine has one */
|
||||
switch (def->os.arch) {
|
||||
@ -4130,12 +4113,12 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
if (addDefaultUSB &&
|
||||
virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_USB, 0) < 0 &&
|
||||
virDomainDefAddUSBController(def, 0, usbModel) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (addImplicitSATA &&
|
||||
virDomainDefMaybeAddController(
|
||||
def, VIR_DOMAIN_CONTROLLER_TYPE_SATA, 0, -1) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
pciRoot = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
|
||||
|
||||
@ -4150,11 +4133,11 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
"model='pci-root' for this machine type, "
|
||||
"but model='%s' was found instead"),
|
||||
virDomainControllerModelPCITypeToString(def->controllers[pciRoot]->model));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else if (!virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
|
||||
VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT)) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4173,18 +4156,18 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
"model='pcie-root' for this machine type, "
|
||||
"but model='%s' was found instead"),
|
||||
virDomainControllerModelPCITypeToString(def->controllers[pciRoot]->model));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else if (!virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0,
|
||||
VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (addDefaultMemballoon && !def->memballoon) {
|
||||
virDomainMemballoonDefPtr memballoon;
|
||||
if (VIR_ALLOC(memballoon) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
|
||||
def->memballoon = memballoon;
|
||||
@ -4219,14 +4202,14 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
virDomainDefMaybeAddInput(def,
|
||||
VIR_DOMAIN_INPUT_TYPE_KBD,
|
||||
VIR_DOMAIN_INPUT_BUS_USB) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (addDefaultUSBMouse &&
|
||||
def->ngraphics > 0 &&
|
||||
virDomainDefMaybeAddInput(def,
|
||||
VIR_DOMAIN_INPUT_TYPE_MOUSE,
|
||||
VIR_DOMAIN_INPUT_BUS_USB) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (addPanicDevice) {
|
||||
size_t j;
|
||||
@ -4245,14 +4228,12 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
|
||||
VIR_APPEND_ELEMENT_COPY(def->panics,
|
||||
def->npanics, panic) < 0) {
|
||||
VIR_FREE(panic);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -13338,19 +13319,16 @@ qemuDomainPopulateDevices(virQEMUDriverConfigPtr cfg,
|
||||
{
|
||||
const char *const *devices = (const char *const *) cfg->cgroupDeviceACL;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
if (!devices)
|
||||
devices = defaultDeviceACL;
|
||||
|
||||
for (i = 0; devices[i]; i++) {
|
||||
if (qemuDomainCreateDevice(devices[i], data, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -13699,7 +13677,6 @@ qemuDomainSetupLoader(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
|
||||
const struct qemuDomainCreateDeviceData *data)
|
||||
{
|
||||
virDomainLoaderDefPtr loader = vm->def->os.loader;
|
||||
int ret = -1;
|
||||
|
||||
VIR_DEBUG("Setting up loader");
|
||||
|
||||
@ -13707,16 +13684,16 @@ qemuDomainSetupLoader(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
|
||||
switch ((virDomainLoader) loader->type) {
|
||||
case VIR_DOMAIN_LOADER_TYPE_ROM:
|
||||
if (qemuDomainCreateDevice(loader->path, data, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_LOADER_TYPE_PFLASH:
|
||||
if (qemuDomainCreateDevice(loader->path, data, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (loader->nvram &&
|
||||
qemuDomainCreateDevice(loader->nvram, data, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_LOADER_TYPE_NONE:
|
||||
@ -13726,9 +13703,7 @@ qemuDomainSetupLoader(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
|
||||
}
|
||||
|
||||
VIR_DEBUG("Setup loader");
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -14318,7 +14293,6 @@ qemuDomainDetachDeviceUnlink(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
char * const *devMountsPath,
|
||||
size_t ndevMountsPath)
|
||||
{
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
if (STRPREFIX(file, QEMU_DEVPREFIX)) {
|
||||
@ -14333,13 +14307,11 @@ qemuDomainDetachDeviceUnlink(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
if (virProcessRunInMountNamespace(vm->pid,
|
||||
qemuDomainDetachDeviceUnlinkHelper,
|
||||
(void *)file) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,7 +223,6 @@ static int
|
||||
qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
|
||||
{
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
/* Default values match QEMU. See spapr_(llan|vscsi|vty).c */
|
||||
|
||||
@ -234,7 +233,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
|
||||
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
||||
|
||||
if (qemuDomainAssignSpaprVIOAddress(def, &net->info, VIO_ADDR_NET) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < def->ncontrollers; i++) {
|
||||
@ -246,7 +245,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
|
||||
}
|
||||
if (qemuDomainAssignSpaprVIOAddress(def, &cont->info,
|
||||
VIO_ADDR_SCSI) < 0) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,7 +256,7 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
|
||||
}
|
||||
if (qemuDomainAssignSpaprVIOAddress(def, &def->serials[i]->info,
|
||||
VIO_ADDR_SERIAL) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->nvram) {
|
||||
@ -265,15 +264,12 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
|
||||
def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
||||
if (qemuDomainAssignSpaprVIOAddress(def, &def->nvram->info,
|
||||
VIO_ADDR_NVRAM) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* No other devices are currently supported on spapr-vio */
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1376,7 +1372,6 @@ static int
|
||||
qemuDomainSetupIsolationGroups(virDomainDefPtr def)
|
||||
{
|
||||
int idx;
|
||||
int ret = -1;
|
||||
|
||||
/* Only pSeries guests care about isolation groups at the moment */
|
||||
if (!qemuDomainIsPSeries(def))
|
||||
@ -1384,7 +1379,7 @@ qemuDomainSetupIsolationGroups(virDomainDefPtr def)
|
||||
|
||||
idx = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0);
|
||||
if (idx < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* We want to prevent hostdevs from being plugged into the default PHB:
|
||||
* we can make sure that doesn't happen by locking its isolation group */
|
||||
@ -1394,13 +1389,10 @@ qemuDomainSetupIsolationGroups(virDomainDefPtr def)
|
||||
if (virDomainDeviceInfoIterate(def,
|
||||
qemuDomainFillDeviceIsolationGroupIter,
|
||||
NULL) < 0) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1500,7 +1492,6 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def G_GNUC_UNUSED,
|
||||
void *opaque)
|
||||
{
|
||||
virDomainPCIAddressSetPtr addrs = opaque;
|
||||
int ret = -1;
|
||||
virPCIDeviceAddressPtr addr = &info->addr.pci;
|
||||
|
||||
if (!virDeviceInfoPCIAddressIsPresent(info) ||
|
||||
@ -1577,12 +1568,10 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def G_GNUC_UNUSED,
|
||||
if (virDomainPCIAddressReserveAddr(addrs, addr,
|
||||
info->pciConnectFlags,
|
||||
info->isolationGroup) < 0) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -3661,7 +3661,6 @@ static int
|
||||
qemuDumpWaitForCompletion(virDomainObjPtr vm)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
int ret = -1;
|
||||
|
||||
VIR_DEBUG("Waiting for dump completion");
|
||||
while (!priv->job.dumpCompleted && !priv->job.abortJob) {
|
||||
@ -3678,14 +3677,11 @@ qemuDumpWaitForCompletion(virDomainObjPtr vm)
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("memory-only dump failed for unknown reason"));
|
||||
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
qemuDomainJobInfoUpdateTime(priv->job.current);
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -3727,21 +3723,19 @@ qemuDumpToFd(virQEMUDriverPtr driver,
|
||||
_("unsupported dumpformat '%s' "
|
||||
"for this QEMU binary"),
|
||||
dumpformat);
|
||||
ret = -1;
|
||||
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat, detach);
|
||||
|
||||
if ((qemuDomainObjExitMonitor(driver, vm) < 0) || ret < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (detach)
|
||||
ret = qemuDumpWaitForCompletion(vm);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -7404,13 +7398,12 @@ static int qemuConnectListDefinedDomains(virConnectPtr conn,
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
||||
virConnectListDefinedDomainsCheckACL,
|
||||
conn);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -7420,13 +7413,12 @@ static int qemuConnectNumOfDefinedDomains(virConnectPtr conn)
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = virDomainObjListNumOfDomains(driver->domains, false,
|
||||
virConnectNumOfDefinedDomainsCheckACL,
|
||||
conn);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -7962,22 +7954,21 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk = dev->data.disk;
|
||||
virDomainDiskDefPtr orig_disk = NULL;
|
||||
virDomainDeviceDef oldDev = { .type = dev->type };
|
||||
int ret = -1;
|
||||
|
||||
if (!(orig_disk = virDomainDiskByTarget(vm->def, disk->dst))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("disk '%s' not found"), disk->dst);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
oldDev.data.disk = orig_disk;
|
||||
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev,
|
||||
VIR_DOMAIN_DEVICE_ACTION_UPDATE,
|
||||
true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (!virStorageSourceIsSameLocation(disk->src, orig_disk->src)) {
|
||||
/* Disk source can be changed only for removable devices */
|
||||
@ -7986,12 +7977,12 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("disk source can be changed only in removable "
|
||||
"drives"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
|
||||
dev->data.disk->src, force) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
dev->data.disk->src = NULL;
|
||||
}
|
||||
@ -7999,9 +7990,7 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
|
||||
orig_disk->startupPolicy = dev->data.disk->startupPolicy;
|
||||
orig_disk->snapshot = dev->data.disk->snapshot;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -12327,20 +12316,16 @@ qemuConnectDomainEventRegister(virConnectPtr conn,
|
||||
virFreeCallback freecb)
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectDomainEventRegisterEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virDomainEventStateRegister(conn,
|
||||
driver->domainEventState,
|
||||
callback, opaque, freecb) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -12349,20 +12334,16 @@ qemuConnectDomainEventDeregister(virConnectPtr conn,
|
||||
virConnectDomainEventCallback callback)
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectDomainEventDeregisterEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virDomainEventStateDeregister(conn,
|
||||
driver->domainEventState,
|
||||
callback) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -12378,7 +12359,7 @@ qemuConnectDomainEventRegisterAny(virConnectPtr conn,
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectDomainEventRegisterAnyEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virDomainEventStateRegisterID(conn,
|
||||
driver->domainEventState,
|
||||
@ -12386,7 +12367,6 @@ qemuConnectDomainEventRegisterAny(virConnectPtr conn,
|
||||
callback, opaque, freecb, &ret) < 0)
|
||||
ret = -1;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -12396,20 +12376,16 @@ qemuConnectDomainEventDeregisterAny(virConnectPtr conn,
|
||||
int callbackID)
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virObjectEventStateDeregisterID(conn,
|
||||
driver->domainEventState,
|
||||
callbackID, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -15029,7 +15005,6 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
bool blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV);
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
bool active = virDomainObjIsActive(vm);
|
||||
bool reuse = (*flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) != 0;
|
||||
@ -15043,7 +15018,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
|
||||
if (disk->snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_NONE &&
|
||||
qemuDomainDiskBlockJobIsActive(dom_disk))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
switch ((virDomainSnapshotLocation) disk->snapshot) {
|
||||
case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL:
|
||||
@ -15054,12 +15029,12 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
_("active qemu domains require external disk "
|
||||
"snapshots; disk %s requested internal"),
|
||||
disk->name);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuDomainSnapshotPrepareDiskInternal(dom_disk,
|
||||
active) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (vm->def->disks[i]->src->format > 0 &&
|
||||
vm->def->disks[i]->src->format != VIR_STORAGE_FILE_QCOW2) {
|
||||
@ -15069,7 +15044,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
disk->name,
|
||||
virStorageFileFormatTypeToString(
|
||||
vm->def->disks[i]->src->format));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -15083,12 +15058,12 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
"is unsupported: %s"),
|
||||
disk->name,
|
||||
virStorageFileFormatTypeToString(disk->src->format));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuDomainSnapshotPrepareDiskExternal(dom_disk, disk,
|
||||
active, reuse, blockdev) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
external++;
|
||||
break;
|
||||
@ -15104,7 +15079,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
case VIR_DOMAIN_SNAPSHOT_LOCATION_LAST:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unexpected code path"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -15112,7 +15087,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_NONE) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("nothing selected for snapshot"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* internal snapshot requires a disk image to store the memory image to, and
|
||||
@ -15122,7 +15097,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("internal and full system snapshots require all "
|
||||
"disks to be selected for snapshot"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* disk snapshot requires at least one disk */
|
||||
@ -15130,7 +15105,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("disk-only snapshots require at least "
|
||||
"one disk to be selected for snapshot"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* For now, we don't allow mixing internal and external disks.
|
||||
@ -15142,7 +15117,7 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("mixing internal and external targets for a snapshot "
|
||||
"is not yet supported"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* internal snapshots + pflash based loader have the following problems:
|
||||
@ -15159,17 +15134,14 @@ qemuDomainSnapshotPrepare(virDomainObjPtr vm,
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("internal snapshots of a VM with pflash based "
|
||||
"firmware are not supported"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Alter flags to let later users know what we learned. */
|
||||
if (external && !active)
|
||||
*flags |= VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -17440,7 +17412,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
case QEMU_BLOCKJOB_TYPE_LAST:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid job type '%d'"), job->type);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
case QEMU_BLOCKJOB_TYPE_PULL:
|
||||
case QEMU_BLOCKJOB_TYPE_COMMIT:
|
||||
@ -17449,7 +17421,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("job type '%s' does not support pivot"),
|
||||
qemuBlockjobTypeToString(job->type));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
case QEMU_BLOCKJOB_TYPE_COPY:
|
||||
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
|
||||
@ -17460,7 +17432,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
||||
_("block job '%s' not ready for pivot yet"),
|
||||
job->name);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
@ -17468,20 +17440,17 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
ret = qemuMonitorJobComplete(priv->mon, job->name);
|
||||
else
|
||||
ret = qemuMonitorDrivePivot(priv->mon, job->name);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0) {
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
return -1;
|
||||
|
||||
/* The pivot failed. The block job in QEMU remains in the synchronised state */
|
||||
if (ret < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (disk && disk->mirror)
|
||||
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
|
||||
job->state = QEMU_BLOCKJOB_STATE_PIVOTING;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -19826,18 +19795,14 @@ qemuConnectListAllDomains(virConnectPtr conn,
|
||||
unsigned int flags)
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_CONNECT_LIST_DOMAINS_FILTERS_ALL, -1);
|
||||
|
||||
if (virConnectListAllDomainsEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = virDomainObjListExport(driver->domains, conn, domains,
|
||||
virConnectListAllDomainsCheckACL, flags);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return virDomainObjListExport(driver->domains, conn, domains,
|
||||
virConnectListAllDomainsCheckACL, flags);
|
||||
}
|
||||
|
||||
static char *
|
||||
@ -19899,7 +19864,7 @@ qemuConnectDomainQemuMonitorEventRegister(virConnectPtr conn,
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectDomainQemuMonitorEventRegisterEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virDomainQemuMonitorEventStateRegisterID(conn,
|
||||
driver->domainEventState,
|
||||
@ -19908,7 +19873,6 @@ qemuConnectDomainQemuMonitorEventRegister(virConnectPtr conn,
|
||||
&ret) < 0)
|
||||
ret = -1;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -19918,19 +19882,15 @@ qemuConnectDomainQemuMonitorEventDeregister(virConnectPtr conn,
|
||||
int callbackID)
|
||||
{
|
||||
virQEMUDriverPtr driver = conn->privateData;
|
||||
int ret = -1;
|
||||
|
||||
if (virConnectDomainQemuMonitorEventDeregisterEnsureACL(conn) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virObjectEventStateDeregisterID(conn, driver->domainEventState,
|
||||
callbackID, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -20812,13 +20772,12 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
{
|
||||
size_t i;
|
||||
struct _virDomainInterfaceStats tmp;
|
||||
int ret = -1;
|
||||
|
||||
if (!virDomainObjIsActive(dom))
|
||||
return 0;
|
||||
|
||||
if (virTypedParamListAddUInt(params, dom->def->nnets, "net.count") < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* Check the path is one of the domain's network interfaces. */
|
||||
for (i = 0; i < dom->def->nnets; i++) {
|
||||
@ -20833,7 +20792,7 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
actualType = virDomainNetGetActualType(net);
|
||||
|
||||
if (virTypedParamListAddString(params, net->ifname, "net.%zu.name", i) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
||||
if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) {
|
||||
@ -20866,9 +20825,7 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
"tx.drop", tmp.tx_drop);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef QEMU_ADD_NET_PARAM
|
||||
|
@ -3325,7 +3325,7 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
|
||||
|
||||
if (!oldbridge || !newbridge) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing bridge name"));
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Change bridge for interface %s: %s -> %s",
|
||||
@ -3334,7 +3334,7 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
|
||||
if (virNetDevExists(newbridge) != 1) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("bridge %s doesn't exist"), newbridge);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = virNetDevBridgeRemovePort(oldbridge, olddev->ifname);
|
||||
@ -4003,20 +4003,19 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
const char *type = virDomainGraphicsTypeToString(dev->type);
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
if (!olddev) {
|
||||
virReportError(VIR_ERR_DEVICE_MISSING,
|
||||
_("cannot find existing graphics device to modify of "
|
||||
"type '%s'"), type);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dev->nListens != olddev->nListens) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("cannot change the number of listen addresses "
|
||||
"on '%s' graphics"), type);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < dev->nListens; i++) {
|
||||
@ -4027,7 +4026,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("cannot change the type of listen address "
|
||||
"on '%s' graphics"), type);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (newlisten->type) {
|
||||
@ -4036,7 +4035,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("cannot change listen address setting "
|
||||
"on '%s' graphics"), type);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -4046,7 +4045,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("cannot change listen address setting "
|
||||
"on '%s' graphics"), type);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -4056,7 +4055,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
||||
_("cannot change listen socket setting "
|
||||
"on '%s' graphics"), type);
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4074,12 +4073,12 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
(olddev->data.vnc.port != dev->data.vnc.port))) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("cannot change port settings on vnc graphics"));
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
if (STRNEQ_NULLABLE(olddev->data.vnc.keymap, dev->data.vnc.keymap)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("cannot change keymap setting on vnc graphics"));
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If a password lifetime was, or is set, or action if connected has
|
||||
@ -4092,13 +4091,12 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
dev->data.vnc.auth.passwd)) {
|
||||
VIR_DEBUG("Updating password on VNC server %p %p",
|
||||
dev->data.vnc.auth.passwd, cfg->vncPassword);
|
||||
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
|
||||
VIR_DOMAIN_GRAPHICS_TYPE_VNC,
|
||||
&dev->data.vnc.auth,
|
||||
cfg->vncPassword,
|
||||
QEMU_ASYNC_JOB_NONE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (qemuDomainChangeGraphicsPasswords(driver, vm,
|
||||
VIR_DOMAIN_GRAPHICS_TYPE_VNC,
|
||||
&dev->data.vnc.auth,
|
||||
cfg->vncPassword,
|
||||
QEMU_ASYNC_JOB_NONE) < 0)
|
||||
return -1;
|
||||
|
||||
/* Steal the new dev's char * reference */
|
||||
VIR_FREE(olddev->data.vnc.auth.passwd);
|
||||
@ -4107,8 +4105,6 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
olddev->data.vnc.auth.validTo = dev->data.vnc.auth.validTo;
|
||||
olddev->data.vnc.auth.expires = dev->data.vnc.auth.expires;
|
||||
olddev->data.vnc.auth.connected = dev->data.vnc.auth.connected;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4120,13 +4116,13 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
(olddev->data.spice.tlsPort != dev->data.spice.tlsPort))) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("cannot change port settings on spice graphics"));
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
if (STRNEQ_NULLABLE(olddev->data.spice.keymap,
|
||||
dev->data.spice.keymap)) {
|
||||
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
||||
_("cannot change keymap setting on spice graphics"));
|
||||
return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We must reset the password if it has changed but also if:
|
||||
@ -4143,14 +4139,12 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
dev->data.spice.auth.passwd)) {
|
||||
VIR_DEBUG("Updating password on SPICE server %p %p",
|
||||
dev->data.spice.auth.passwd, cfg->spicePassword);
|
||||
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
|
||||
VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
|
||||
&dev->data.spice.auth,
|
||||
cfg->spicePassword,
|
||||
QEMU_ASYNC_JOB_NONE);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (qemuDomainChangeGraphicsPasswords(driver, vm,
|
||||
VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
|
||||
&dev->data.spice.auth,
|
||||
cfg->spicePassword,
|
||||
QEMU_ASYNC_JOB_NONE) < 0)
|
||||
return -1;
|
||||
|
||||
/* Steal the new dev's char * reference */
|
||||
VIR_FREE(olddev->data.spice.auth.passwd);
|
||||
@ -4161,7 +4155,6 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
olddev->data.spice.auth.connected = dev->data.spice.auth.connected;
|
||||
} else {
|
||||
VIR_DEBUG("Not updating since password didn't change");
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4178,7 +4171,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,7 +53,6 @@ VIR_LOG_INIT("qemu.qemu_interface");
|
||||
int
|
||||
qemuInterfaceStartDevice(virDomainNetDefPtr net)
|
||||
{
|
||||
int ret = -1;
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
|
||||
switch (actualType) {
|
||||
@ -71,7 +70,7 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
|
||||
if (virNetDevBridgeFDBAdd(&net->mac, net->ifname,
|
||||
VIR_NETDEVBRIDGE_FDB_FLAG_MASTER |
|
||||
VIR_NETDEVBRIDGE_FDB_FLAG_TEMP) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -84,9 +83,9 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
|
||||
* some sort of "blip" in the physdev's status.
|
||||
*/
|
||||
if (physdev && virNetDevGetOnline(physdev, &isOnline) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
if (!isOnline && virNetDevSetOnline(physdev, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* macvtap devices share their MAC address with the guest
|
||||
* domain, and if they are set online prior to the domain CPUs
|
||||
@ -101,13 +100,13 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
|
||||
* we are starting the domain CPUs.
|
||||
*/
|
||||
if (virNetDevSetOnline(net->ifname, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||
if (virNetDevIPInfoAddToDev(net->ifname, &net->hostIP) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
break;
|
||||
|
||||
@ -124,9 +123,7 @@ qemuInterfaceStartDevice(virDomainNetDefPtr net)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +156,6 @@ qemuInterfaceStartDevices(virDomainDefPtr def)
|
||||
int
|
||||
qemuInterfaceStopDevice(virDomainNetDefPtr net)
|
||||
{
|
||||
int ret = -1;
|
||||
virDomainNetType actualType = virDomainNetGetActualType(net);
|
||||
|
||||
switch (actualType) {
|
||||
@ -173,7 +169,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
|
||||
if (virNetDevBridgeFDBDel(&net->mac, net->ifname,
|
||||
VIR_NETDEVBRIDGE_FDB_FLAG_MASTER |
|
||||
VIR_NETDEVBRIDGE_FDB_FLAG_TEMP) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -186,7 +182,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
|
||||
* on this network.
|
||||
*/
|
||||
if (virNetDevSetOnline(net->ifname, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* also mark the physdev down for passthrough macvtap, as the
|
||||
* physdev has the same MAC address as the macvtap device.
|
||||
@ -194,7 +190,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
|
||||
if (virDomainNetGetActualDirectMode(net) ==
|
||||
VIR_NETDEV_MACVLAN_MODE_PASSTHRU &&
|
||||
physdev && virNetDevSetOnline(physdev, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -212,9 +208,7 @@ qemuInterfaceStopDevice(virDomainNetDefPtr net)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1768,7 +1768,6 @@ qemuMigrationDstOPDRelocate(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
qemuMigrationCookiePtr cookie)
|
||||
{
|
||||
virDomainNetDefPtr netptr;
|
||||
int ret = -1;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < cookie->network->nnets; i++) {
|
||||
@ -1785,7 +1784,7 @@ qemuMigrationDstOPDRelocate(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to run command to set OVS port data for "
|
||||
"interface %s"), netptr->ifname);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1793,9 +1792,7 @@ qemuMigrationDstOPDRelocate(virQEMUDriverPtr driver G_GNUC_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1846,7 +1843,6 @@ qemuMigrationDstRun(virQEMUDriverPtr driver,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
int ret = -1;
|
||||
int rv;
|
||||
|
||||
VIR_DEBUG("Setting up incoming migration with URI %s", uri);
|
||||
@ -1857,21 +1853,17 @@ qemuMigrationDstRun(virQEMUDriverPtr driver,
|
||||
rv = qemuMonitorMigrateIncoming(priv->mon, uri);
|
||||
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) {
|
||||
/* qemuMigrationDstWaitForCompletion is called from the Finish phase */
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (qemuMigrationDstWaitForCompletion(driver, vm, asyncJob, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -4657,9 +4649,9 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
|
||||
if (!(flags & VIR_MIGRATE_CHANGE_PROTECTION)) {
|
||||
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT,
|
||||
flags) < 0)
|
||||
goto cleanup;
|
||||
return ret;
|
||||
} else if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_OUT)) {
|
||||
goto cleanup;
|
||||
return ret;
|
||||
}
|
||||
|
||||
qemuMigrationJobStartPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
|
||||
@ -4694,7 +4686,6 @@ qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
|
||||
if (!virDomainObjIsActive(vm))
|
||||
qemuDomainRemoveInactiveJob(driver, vm);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -5318,7 +5309,6 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
bool storage = false;
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
VIR_DEBUG("Canceling unfinished outgoing migration of domain %s",
|
||||
vm->def->name);
|
||||
@ -5326,7 +5316,7 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
ignore_value(qemuMonitorMigrateCancel(priv->mon));
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < vm->def->ndisks; i++) {
|
||||
virDomainDiskDefPtr disk = vm->def->disks[i];
|
||||
@ -5348,12 +5338,9 @@ qemuMigrationSrcCancel(virQEMUDriverPtr driver,
|
||||
if (storage &&
|
||||
qemuMigrationSrcNBDCopyCancel(driver, vm, false,
|
||||
QEMU_ASYNC_JOB_NONE, NULL) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2243,24 +2243,21 @@ qemuProcessRefreshPRManagerState(virDomainObjPtr vm,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
qemuMonitorPRManagerInfoPtr prManagerInfo;
|
||||
const char *managedAlias = qemuDomainGetManagedPRAlias();
|
||||
int ret = -1;
|
||||
|
||||
if (!(prManagerInfo = virHashLookup(info, managedAlias))) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("missing info on pr-manager %s"),
|
||||
managedAlias);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
priv->prDaemonRunning = prManagerInfo->connected;
|
||||
|
||||
if (!priv->prDaemonRunning &&
|
||||
qemuProcessStartManagedPRDaemon(vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -4982,16 +4979,15 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
|
||||
virDomainGraphicsDefPtr graphics;
|
||||
bool allocate = !(flags & VIR_QEMU_PROCESS_START_PRETEND);
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
for (i = 0; i < vm->def->ngraphics; i++) {
|
||||
graphics = vm->def->graphics[i];
|
||||
|
||||
if (qemuProcessGraphicsSetupRenderNode(graphics, qemuCaps) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuProcessGraphicsSetupListen(driver, graphics, vm) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (allocate) {
|
||||
@ -4999,7 +4995,7 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
|
||||
graphics = vm->def->graphics[i];
|
||||
|
||||
if (qemuProcessGraphicsReservePorts(graphics, false) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5007,13 +5003,10 @@ qemuProcessSetupGraphics(virQEMUDriverPtr driver,
|
||||
graphics = vm->def->graphics[i];
|
||||
|
||||
if (qemuProcessGraphicsAllocatePorts(driver, graphics, allocate) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -5114,20 +5107,15 @@ qemuProcessMakeDir(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *path)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (virFileMakePathWithMode(path, 0750) < 0) {
|
||||
virReportSystemError(errno, _("Cannot create directory '%s'"), path);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuSecurityDomainSetPathLabel(driver, vm, path, true) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -8443,7 +8431,6 @@ static int
|
||||
qemuProcessQMPInit(qemuProcessQMPPtr proc)
|
||||
{
|
||||
char *template = NULL;
|
||||
int ret = -1;
|
||||
|
||||
VIR_DEBUG("proc=%p, emulator=%s", proc, proc->binary);
|
||||
|
||||
@ -8454,11 +8441,11 @@ qemuProcessQMPInit(qemuProcessQMPPtr proc)
|
||||
_("Failed to create unique directory with "
|
||||
"template '%s' for probing QEMU"),
|
||||
template);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuProcessQEMULabelUniqPath(proc) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
proc->monpath = g_strdup_printf("%s/%s", proc->uniqDir, "qmp.monitor");
|
||||
|
||||
@ -8471,10 +8458,7 @@ qemuProcessQMPInit(qemuProcessQMPPtr proc)
|
||||
*/
|
||||
proc->pidfile = g_strdup_printf("%s/%s", proc->uniqDir, "qmp.pid");
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -8483,7 +8467,6 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
|
||||
{
|
||||
const char *machine;
|
||||
int status = 0;
|
||||
int ret = -1;
|
||||
int rc;
|
||||
|
||||
if (proc->forceTCG)
|
||||
@ -8527,7 +8510,7 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
|
||||
virCommandSetErrorBuffer(proc->cmd, &(proc->stdErr));
|
||||
|
||||
if (virCommandRun(proc->cmd, &status) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (status != 0) {
|
||||
VIR_DEBUG("QEMU %s exited with status %d", proc->binary, status);
|
||||
@ -8535,18 +8518,15 @@ qemuProcessQMPLaunch(qemuProcessQMPPtr proc)
|
||||
_("Failed to start QEMU binary %s for probing: %s"),
|
||||
proc->binary,
|
||||
proc->stdErr ? proc->stdErr : _("unknown error"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((rc = virPidFileReadPath(proc->pidfile, &proc->pid)) < 0) {
|
||||
virReportSystemError(-rc, _("Failed to read pidfile %s"), proc->pidfile);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -8619,21 +8599,16 @@ qemuProcessQMPConnectMonitor(qemuProcessQMPPtr proc)
|
||||
int
|
||||
qemuProcessQMPStart(qemuProcessQMPPtr proc)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
VIR_DEBUG("proc=%p, emulator=%s", proc, proc->binary);
|
||||
|
||||
if (qemuProcessQMPInit(proc) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuProcessQMPLaunch(proc) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuProcessQMPConnectMonitor(proc) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
@ -314,8 +314,6 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDefPtr tpm,
|
||||
uid_t qemu_user,
|
||||
const char *shortName)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
if (virTPMEmulatorInit() < 0)
|
||||
return -1;
|
||||
|
||||
@ -326,7 +324,7 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDefPtr tpm,
|
||||
/* ... and adjust ownership */
|
||||
if (virDirCreate(logDir, 0730, swtpm_user, swtpm_group,
|
||||
VIR_DIR_CREATE_ALLOW_EXIST) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* create logfile name ... */
|
||||
if (!tpm->data.emulator.logfile)
|
||||
@ -334,7 +332,7 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDefPtr tpm,
|
||||
|
||||
if (!virFileExists(tpm->data.emulator.logfile) &&
|
||||
virFileTouch(tpm->data.emulator.logfile, 0644) < 0) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ... and make sure it can be accessed by swtpm_user */
|
||||
@ -342,7 +340,7 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDefPtr tpm,
|
||||
virReportSystemError(errno,
|
||||
_("Could not chown on swtpm logfile %s"),
|
||||
tpm->data.emulator.logfile);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -354,20 +352,16 @@ qemuTPMEmulatorPrepareHost(virDomainTPMDefPtr tpm,
|
||||
*/
|
||||
if (virDirCreate(swtpmStateDir, 0770, qemu_user, swtpm_group,
|
||||
VIR_DIR_CREATE_ALLOW_EXIST) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
/* create the socket filename */
|
||||
if (!tpm->data.emulator.source.data.nix.path &&
|
||||
!(tpm->data.emulator.source.data.nix.path =
|
||||
qemuTPMCreateEmulatorSocket(swtpmStateDir, shortName)))
|
||||
goto cleanup;
|
||||
return -1;
|
||||
tpm->data.emulator.source.type = VIR_DOMAIN_CHR_TYPE_UNIX;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user