mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
qemu: remove unneeded labels
Remove unneeded, easy to remove goto labels (cleanup|error|done|...). Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
049ddf57da
commit
21ad56e932
@ -781,23 +781,22 @@ virQEMUCapsFindBinaryForArch(virArch hostarch,
|
||||
if (hostarch == VIR_ARCH_AARCH64 && guestarch == VIR_ARCH_ARMV7L) {
|
||||
archstr = virQEMUCapsArchToString(hostarch);
|
||||
if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL)
|
||||
goto out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* First attempt: try the guest architecture as it is */
|
||||
archstr = virQEMUCapsArchToString(guestarch);
|
||||
if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
/* Second attempt: try looking up by target instead */
|
||||
target = virQEMUCapsFindTarget(hostarch, guestarch);
|
||||
if (target != guestarch) {
|
||||
archstr = virQEMUCapsArchToString(target);
|
||||
if ((ret = virQEMUCapsFindBinary("qemu-system-%s", archstr)) != NULL)
|
||||
goto out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -5013,13 +5012,11 @@ virQEMUCapsNewForBinaryInternal(virArch hostArch,
|
||||
qemuCaps->kvmSupportsNesting = virQEMUCapsKVMSupportsNesting();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return qemuCaps;
|
||||
|
||||
error:
|
||||
virObjectUnref(qemuCaps);
|
||||
qemuCaps = NULL;
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
@ -5052,13 +5049,11 @@ virQEMUCapsLoadFile(const char *filename,
|
||||
if (virQEMUCapsLoadCache(priv->hostArch, qemuCaps, filename) < 0)
|
||||
goto error;
|
||||
|
||||
cleanup:
|
||||
return qemuCaps;
|
||||
|
||||
error:
|
||||
virObjectUnref(qemuCaps);
|
||||
qemuCaps = NULL;
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1776,12 +1776,12 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
disk->detect_zeroes);
|
||||
|
||||
if (qemuBuildDriveSourceStr(disk, qemuCaps, &opt) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (!qemuDiskBusNeedsDriveArg(disk->bus)) {
|
||||
g_autofree char *drivealias = qemuAliasDiskDriveFromDisk(disk);
|
||||
if (!drivealias)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
virBufferAddLit(&opt, "if=none");
|
||||
virBufferAsprintf(&opt, ",id=%s", drivealias);
|
||||
@ -1791,12 +1791,12 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
if (idx < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported disk type '%s'"), disk->dst);
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* if we are using -device this will be checked elsewhere */
|
||||
if (qemuCheckDiskConfig(disk, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
virBufferAsprintf(&opt, "if=%s",
|
||||
virDomainDiskQEMUBusTypeToString(disk->bus));
|
||||
@ -1849,9 +1849,6 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
|
||||
qemuBuildDiskThrottling(disk, &opt);
|
||||
|
||||
return virBufferContentAndReset(&opt);
|
||||
|
||||
error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -1941,20 +1938,20 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
int controllerModel;
|
||||
|
||||
if (qemuCheckDiskConfig(disk, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (!qemuDomainCheckCCWS390AddressSupport(def, &disk->info, qemuCaps, disk->dst))
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (disk->iothread && !qemuCheckIOThreads(def, disk))
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
switch ((virDomainDiskBus) disk->bus) {
|
||||
case VIR_DOMAIN_DISK_BUS_IDE:
|
||||
if (disk->info.addr.drive.target != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("target must be 0 for ide controller"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disk->wwn &&
|
||||
@ -1962,7 +1959,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Setting wwn for ide disk is not supported "
|
||||
"by this QEMU"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
|
||||
@ -1979,7 +1976,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
if (!(contAlias = virDomainControllerAliasFind(def,
|
||||
VIR_DOMAIN_CONTROLLER_TYPE_IDE,
|
||||
disk->info.addr.drive.controller)))
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&opt, ",bus=%s.%d,unit=%d",
|
||||
contAlias,
|
||||
@ -1993,7 +1990,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This QEMU doesn't support scsi-block for "
|
||||
"lun passthrough"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2002,7 +1999,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Setting wwn for scsi disk is not supported "
|
||||
"by this QEMU"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Properties wwn, vendor and product were introduced in the
|
||||
@ -2013,12 +2010,12 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Setting vendor or product for scsi disk is not "
|
||||
"supported by this QEMU"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
controllerModel = qemuDomainFindSCSIControllerModel(def, &disk->info);
|
||||
if (controllerModel < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
|
||||
virBufferAddLit(&opt, "scsi-block");
|
||||
@ -2038,21 +2035,21 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
scsiVPDDeviceId = g_strdup(disk->serial);
|
||||
} else {
|
||||
if (!(scsiVPDDeviceId = qemuAliasDiskDriveFromDisk(disk)))
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(contAlias = virDomainControllerAliasFind(def, VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
|
||||
disk->info.addr.drive.controller)))
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (controllerModel == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC) {
|
||||
if (disk->info.addr.drive.target != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("target must be 0 for controller "
|
||||
"model 'lsilogic'"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virBufferAsprintf(&opt, ",bus=%s.%d,scsi-id=%d",
|
||||
@ -2065,7 +2062,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This QEMU doesn't support target "
|
||||
"greater than 7"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disk->info.addr.drive.bus != 0 &&
|
||||
@ -2073,7 +2070,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This QEMU only supports both bus and "
|
||||
"unit equal to 0"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2093,12 +2090,12 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
if (disk->info.addr.drive.bus != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("bus must be 0 for ide controller"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
if (disk->info.addr.drive.target != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("target must be 0 for ide controller"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
|
||||
@ -2116,7 +2113,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
if (!(contAlias = virDomainControllerAliasFind(def,
|
||||
VIR_DOMAIN_CONTROLLER_TYPE_SATA,
|
||||
disk->info.addr.drive.controller)))
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&opt, ",bus=%s.%d",
|
||||
contAlias,
|
||||
@ -2126,7 +2123,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
||||
if (qemuBuildVirtioDevStr(&opt, "virtio-blk", qemuCaps,
|
||||
VIR_DOMAIN_DEVICE_DISK, disk) < 0) {
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disk->iothread)
|
||||
@ -2152,17 +2149,17 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("num-queues property isn't supported by this "
|
||||
"QEMU binary"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virBufferAsprintf(&opt, ",num-queues=%u", disk->queues);
|
||||
}
|
||||
|
||||
if (qemuBuildVirtioOptionsStr(&opt, disk->virtio, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_USB:
|
||||
@ -2170,19 +2167,19 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("unexpected address type for usb disk"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This QEMU doesn't support '-device "
|
||||
"usb-storage'"));
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
}
|
||||
virBufferAddLit(&opt, "usb-storage");
|
||||
|
||||
if (qemuBuildDeviceAddressStr(&opt, def, &disk->info, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_FDC:
|
||||
@ -2196,7 +2193,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unsupported disk bus '%s' with device setup"), bus);
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (disk->src->shared &&
|
||||
@ -2204,7 +2201,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virBufferAddLit(&opt, ",share-rw=on");
|
||||
|
||||
if (qemuDomainDiskGetBackendAlias(disk, qemuCaps, &backendAlias) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
if (backendAlias)
|
||||
virBufferAsprintf(&opt, ",drive=%s", backendAlias);
|
||||
@ -2249,13 +2246,13 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("This QEMU doesn't support setting the "
|
||||
"removable flag of USB storage devices"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qemuBuildDriveDevCacheStr(disk, &opt, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
qemuBuildDiskFrontendAttributes(disk, &opt);
|
||||
|
||||
@ -2263,9 +2260,6 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
|
||||
qemuBuildDiskFrontendAttributeErrorPolicy(disk, &opt);
|
||||
|
||||
return virBufferContentAndReset(&opt);
|
||||
|
||||
error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
@ -3693,7 +3687,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
if (virDomainNetIsVirtioModel(net)) {
|
||||
if (qemuBuildVirtioDevStr(&buf, "virtio-net", qemuCaps,
|
||||
VIR_DOMAIN_DEVICE_NET, net) < 0) {
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
usingVirtio = true;
|
||||
@ -3723,12 +3717,12 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
*/
|
||||
virReportEnumRangeError(virDomainNetVirtioTxModeType,
|
||||
net->driver.virtio.txmode);
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("virtio-net-pci 'tx' option not supported in this QEMU binary"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (usingVirtio) {
|
||||
@ -3804,7 +3798,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("virtio rx_queue_size option is not supported with this QEMU binary"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
|
||||
}
|
||||
@ -3812,7 +3806,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("virtio tx_queue_size option is not supported with this QEMU binary"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&buf, ",tx_queue_size=%u", net->driver.virtio.tx_queue_size);
|
||||
}
|
||||
@ -3821,7 +3815,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("setting MTU is not supported with this QEMU binary"));
|
||||
goto error;
|
||||
return NULL;
|
||||
}
|
||||
virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu);
|
||||
}
|
||||
@ -3832,19 +3826,16 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
virMacAddrFormat(&net->mac, macaddr));
|
||||
|
||||
if (qemuBuildDeviceAddressStr(&buf, def, &net->info, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
if (qemuBuildRomStr(&buf, &net->info) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
if (bootindex)
|
||||
virBufferAsprintf(&buf, ",bootindex=%u", bootindex);
|
||||
if (usingVirtio &&
|
||||
qemuBuildVirtioOptionsStr(&buf, net->virtio, qemuCaps) < 0)
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
return virBufferContentAndReset(&buf);
|
||||
|
||||
error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -13111,7 +13111,7 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
|
||||
/* prefer the hard limit */
|
||||
if (virMemoryLimitIsSet(def->mem.hard_limit)) {
|
||||
memKB = def->mem.hard_limit;
|
||||
goto done;
|
||||
return memKB << 10;
|
||||
}
|
||||
|
||||
/* If the guest wants its memory to be locked, we need to raise the memory
|
||||
@ -13159,7 +13159,6 @@ qemuDomainGetMemLockLimitBytes(virDomainDefPtr def,
|
||||
if (usesVFIO || forceVFIO)
|
||||
memKB = virDomainDefGetMemoryTotal(def) + 1024 * 1024;
|
||||
|
||||
done:
|
||||
return memKB << 10;
|
||||
}
|
||||
|
||||
@ -13186,7 +13185,6 @@ qemuDomainAdjustMaxMemLock(virDomainObjPtr vm,
|
||||
bool forceVFIO)
|
||||
{
|
||||
unsigned long long bytes = 0;
|
||||
int ret = -1;
|
||||
|
||||
bytes = qemuDomainGetMemLockLimitBytes(vm->def, forceVFIO);
|
||||
|
||||
@ -13208,12 +13206,9 @@ qemuDomainAdjustMaxMemLock(virDomainObjPtr vm,
|
||||
|
||||
/* Trying to set the memory locking limit to zero is a no-op */
|
||||
if (virProcessSetMaxMemLock(vm->pid, bytes) < 0)
|
||||
goto out;
|
||||
return -1;
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1257,7 +1257,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||
/* Only PCI host devices are subject to isolation */
|
||||
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
|
||||
hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
||||
goto skip;
|
||||
return 0;
|
||||
}
|
||||
|
||||
hostAddr = &hostdev->source.subsys.u.pci.addr;
|
||||
@ -1265,7 +1265,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||
/* If a non-default isolation has already been assigned to the
|
||||
* device, we can avoid looking up the information again */
|
||||
if (info->isolationGroup > 0)
|
||||
goto skip;
|
||||
return 0;
|
||||
|
||||
/* The isolation group depends on the IOMMU group assigned by the host */
|
||||
tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr);
|
||||
@ -1275,7 +1275,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||
"%04x:%02x:%02x.%x, device won't be isolated",
|
||||
hostAddr->domain, hostAddr->bus,
|
||||
hostAddr->slot, hostAddr->function);
|
||||
goto skip;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The isolation group for a host device is its IOMMU group,
|
||||
@ -1301,13 +1301,13 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||
* require us to isolate the guest device, so we can skip them */
|
||||
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||
virDomainNetResolveActualType(iface) != VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
||||
goto skip;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If a non-default isolation has already been assigned to the
|
||||
* device, we can avoid looking up the information again */
|
||||
if (info->isolationGroup > 0)
|
||||
goto skip;
|
||||
return 0;
|
||||
|
||||
/* Obtain a synthetic isolation group for the device, since at this
|
||||
* point in time we don't have access to the IOMMU group of the host
|
||||
@ -1319,7 +1319,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||
"configured to use hostdev-backed network '%s', "
|
||||
"device won't be isolated",
|
||||
iface->data.network.name);
|
||||
goto skip;
|
||||
return 0;
|
||||
}
|
||||
|
||||
info->isolationGroup = tmp;
|
||||
@ -1329,7 +1329,6 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||
iface->data.network.name, info->isolationGroup);
|
||||
}
|
||||
|
||||
skip:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2131,7 +2130,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &cont->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2142,7 +2141,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
/* Only support VirtIO-9p-pci so far. If that changes,
|
||||
* we might need to skip devices here */
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->fss[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Network interfaces */
|
||||
@ -2159,7 +2158,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &net->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Sound cards */
|
||||
@ -2177,7 +2176,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &sound->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Device controllers (SCSI, USB, but not IDE, FDC or CCID) */
|
||||
@ -2246,7 +2245,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
if (virDomainPCIAddressReserveAddr(addrs, &addr,
|
||||
cont->info.pciConnectFlags,
|
||||
cont->info.isolationGroup) < 0) {
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cont->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
@ -2257,14 +2256,14 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
if (virDomainPCIAddressReserveNextAddr(addrs, &cont->info,
|
||||
cont->info.pciConnectFlags,
|
||||
addr.function) < 0) {
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cont->info.addr.pci.multi = addr.multi;
|
||||
}
|
||||
} else {
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &cont->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2292,11 +2291,11 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("virtio disk cannot have an address of type '%s'"),
|
||||
virDomainDeviceAddressTypeToString(def->disks[i]->info.type));
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->disks[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Host PCI devices */
|
||||
@ -2320,7 +2319,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs,
|
||||
def->hostdevs[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* memballoon. the qemu driver only accepts virtio memballoon devices */
|
||||
@ -2328,7 +2327,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) {
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs,
|
||||
&def->memballoon->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* the qemu driver only accepts virtio rng devices */
|
||||
@ -2337,7 +2336,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* A watchdog - check if it is a PCI device */
|
||||
@ -2345,7 +2344,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
def->watchdog->model == VIR_DOMAIN_WATCHDOG_MODEL_I6300ESB &&
|
||||
virDeviceInfoPCIAddressIsWanted(&def->watchdog->info)) {
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->watchdog->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Video devices */
|
||||
@ -2358,7 +2357,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Shared Memory */
|
||||
@ -2367,7 +2366,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->shmems[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < def->ninputs; i++) {
|
||||
if (def->inputs[i]->bus != VIR_DOMAIN_INPUT_BUS_VIRTIO ||
|
||||
@ -2375,7 +2374,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->inputs[i]->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < def->nparallels; i++) {
|
||||
/* Nada - none are PCI based (yet) */
|
||||
@ -2388,7 +2387,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
continue;
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs, &chr->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < def->nchannels; i++) {
|
||||
/* Nada - none are PCI based (yet) */
|
||||
@ -2402,13 +2401,10 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
|
||||
|
||||
if (qemuDomainPCIAddressReserveNextAddr(addrs,
|
||||
&def->vsock->info) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1916,7 +1916,7 @@ qemuDomainShutdownFlagsAgent(virQEMUDriverPtr driver,
|
||||
|
||||
if (qemuDomainObjBeginAgentJob(driver, vm,
|
||||
QEMU_AGENT_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
@ -1934,8 +1934,6 @@ qemuDomainShutdownFlagsAgent(virQEMUDriverPtr driver,
|
||||
|
||||
endjob:
|
||||
qemuDomainObjEndAgentJob(vm);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1951,7 +1949,7 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriverPtr driver,
|
||||
priv = vm->privateData;
|
||||
|
||||
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
@ -1967,8 +1965,6 @@ qemuDomainShutdownFlagsMonitor(virQEMUDriverPtr driver,
|
||||
|
||||
endjob:
|
||||
qemuDomainObjEndJob(driver, vm);
|
||||
|
||||
cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -6784,14 +6780,13 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
||||
*ret_def = def;
|
||||
*ret_data = data;
|
||||
|
||||
cleanup:
|
||||
return fd;
|
||||
|
||||
error:
|
||||
virDomainDefFree(def);
|
||||
virQEMUSaveDataFree(data);
|
||||
VIR_FORCE_CLOSE(fd);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6)
|
||||
@ -12620,7 +12615,6 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
|
||||
{
|
||||
virQEMUDriverPtr driver = dconn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
virDomainPtr dom = NULL;
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
|
||||
|
||||
@ -12629,24 +12623,21 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("no domain with matching name '%s'"), dname);
|
||||
qemuMigrationDstErrorReport(driver, dname);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (virDomainMigrateFinish2EnsureACL(dconn, vm->def) < 0) {
|
||||
virDomainObjEndAPI(&vm);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Do not use cookies in v2 protocol, since the cookie
|
||||
* length was not sufficiently large, causing failures
|
||||
* migrating between old & new libvirtd
|
||||
*/
|
||||
dom = qemuMigrationDstFinish(driver, dconn, vm,
|
||||
NULL, 0, NULL, NULL, /* No cookies */
|
||||
flags, retcode, false);
|
||||
|
||||
cleanup:
|
||||
return dom;
|
||||
return qemuMigrationDstFinish(driver, dconn, vm,
|
||||
NULL, 0, NULL, NULL, /* No cookies */
|
||||
flags, retcode, false);
|
||||
}
|
||||
|
||||
|
||||
@ -13260,7 +13251,6 @@ qemuNodeDeviceGetPCIInfo(virNodeDeviceDefPtr def,
|
||||
unsigned *function)
|
||||
{
|
||||
virNodeDevCapsDefPtr cap;
|
||||
int ret = -1;
|
||||
|
||||
cap = def->caps;
|
||||
while (cap) {
|
||||
@ -13278,12 +13268,10 @@ qemuNodeDeviceGetPCIInfo(virNodeDeviceDefPtr def,
|
||||
if (!cap) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("device %s is not a PCI device"), def->name);
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -243,17 +243,14 @@ qemuHostdevPreparePCIDevices(virQEMUDriverPtr driver,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
unsigned int flags)
|
||||
{
|
||||
int ret = -1;
|
||||
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
|
||||
|
||||
if (!qemuHostdevPreparePCIDevicesCheckSupport(hostdevs, nhostdevs, qemuCaps))
|
||||
goto out;
|
||||
return -1;
|
||||
|
||||
ret = virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME,
|
||||
name, uuid, hostdevs,
|
||||
nhostdevs, flags);
|
||||
out:
|
||||
return ret;
|
||||
return virHostdevPreparePCIDevices(hostdev_mgr, QEMU_DRIVER_NAME,
|
||||
name, uuid, hostdevs,
|
||||
nhostdevs, flags);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2894,41 +2894,38 @@ qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||
if (qemuDomainAttachHostPCIDevice(driver, vm,
|
||||
hostdev) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
||||
if (qemuDomainAttachHostUSBDevice(driver, vm,
|
||||
hostdev) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
||||
if (qemuDomainAttachHostSCSIDevice(driver, vm,
|
||||
hostdev) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
|
||||
if (qemuDomainAttachSCSIVHostDevice(driver, vm, hostdev) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
break;
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
|
||||
if (qemuDomainAttachMediatedDevice(driver, vm, hostdev) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("hotplug is not supported for hostdev subsys type '%s'"),
|
||||
virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -971,14 +971,12 @@ qemuMigrationCookieNetworkXMLParse(xmlXPathContextPtr ctxt)
|
||||
|
||||
VIR_FREE(interfaces);
|
||||
|
||||
cleanup:
|
||||
return optr;
|
||||
|
||||
error:
|
||||
VIR_FREE(interfaces);
|
||||
qemuMigrationCookieNetworkFree(optr);
|
||||
optr = NULL;
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -1053,10 +1051,10 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||
|
||||
if (!(ctxt->node = virXPathNode("./statistics", ctxt)))
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
if (VIR_ALLOC(jobInfo) < 0)
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
|
||||
stats = &jobInfo->stats.mig;
|
||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_COMPLETED;
|
||||
@ -1127,7 +1125,7 @@ qemuMigrationCookieStatisticsXMLParse(xmlXPathContextPtr ctxt)
|
||||
|
||||
virXPathInt("string(./" VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "[1])",
|
||||
ctxt, &stats->cpu_throttle_percentage);
|
||||
cleanup:
|
||||
|
||||
return jobInfo;
|
||||
}
|
||||
|
||||
|
@ -480,14 +480,14 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params,
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("Unsupported compression method '%s'"),
|
||||
params[i].value.s);
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (migParams->compMethods & (1ULL << method)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("Compression method '%s' is specified twice"),
|
||||
params[i].value.s);
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
migParams->compMethods |= 1ULL << method;
|
||||
@ -514,14 +514,14 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params,
|
||||
!(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_MT))) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("Turn multithread compression on to tune it"));
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (migParams->params[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE].set &&
|
||||
!(migParams->compMethods & (1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE))) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("Turn xbzrle compression on to tune it"));
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!migParams->compMethods && (flags & VIR_MIGRATE_COMPRESSED)) {
|
||||
@ -531,9 +531,6 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params,
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user