mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-31 00:45:18 +00:00
qemu: Introduce qemuDomainMachineIsS390CCW
Rather than have different usages of STR function in order to determine whether the domain is s390-ccw or s390-ccw-virtio, make a single API which will check the machine.os prefix. Then use the function.
This commit is contained in:
parent
682775fbb8
commit
d334c91751
@ -1342,7 +1342,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
||||
virDomainCCWAddressSetPtr addrs = NULL;
|
||||
qemuDomainObjPrivatePtr priv = NULL;
|
||||
|
||||
if (STREQLEN(def->os.machine, "s390-ccw", 8) &&
|
||||
if (qemuDomainMachineIsS390CCW(def) &&
|
||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
qemuDomainPrimeVirtioDeviceAddresses(
|
||||
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
||||
@ -1864,7 +1864,7 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
|
||||
devstr = info->alias;
|
||||
|
||||
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
STREQLEN(vm->def->os.machine, "s390-ccw", 8) &&
|
||||
qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW) &&
|
||||
virDomainCCWAddressReleaseAddr(priv->ccwaddrs, info) < 0)
|
||||
VIR_WARN("Unable to release CCW address on %s",
|
||||
|
@ -3323,6 +3323,12 @@ qemuDomainMachineNeedsFDC(const virDomainDef *def)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
qemuDomainMachineIsS390CCW(const virDomainDef *def)
|
||||
{
|
||||
return STRPREFIX(def->os.machine, "s390-ccw");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuDomainUpdateCurrentMemorySize:
|
||||
|
@ -469,6 +469,7 @@ virDomainChrSourceDefPtr qemuFindAgentConfig(virDomainDefPtr def);
|
||||
bool qemuDomainMachineIsQ35(const virDomainDef *def);
|
||||
bool qemuDomainMachineIsI440FX(const virDomainDef *def);
|
||||
bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
|
||||
bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
|
||||
|
||||
int qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
|
@ -326,7 +326,7 @@ qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
|
||||
const char *src = virDomainDiskGetSource(disk);
|
||||
|
||||
if (!disk->info.type) {
|
||||
if (STREQLEN(vm->def->os.machine, "s390-ccw", 8) &&
|
||||
if (qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
|
||||
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
||||
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
|
||||
@ -443,7 +443,7 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
|
||||
|
||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
if (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
if (STRPREFIX(vm->def->os.machine, "s390-ccw") &&
|
||||
if (qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW))
|
||||
controller->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
||||
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
|
||||
@ -991,7 +991,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STREQLEN(vm->def->os.machine, "s390-ccw", 8) &&
|
||||
if (qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
net->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
||||
if (virDomainCCWAddressAssign(&net->info, priv->ccwaddrs,
|
||||
@ -1657,7 +1657,7 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
|
||||
return -1;
|
||||
|
||||
if (rng->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
|
||||
if (STRPREFIX(vm->def->os.machine, "s390-ccw") &&
|
||||
if (qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
rng->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
||||
} else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
|
||||
@ -3412,7 +3412,7 @@ qemuDomainDetachVirtioDiskDevice(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (STREQLEN(vm->def->os.machine, "s390-ccw", 8) &&
|
||||
if (qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
if (!virDomainDeviceAddressIsValid(&detach->info,
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
|
||||
@ -3942,7 +3942,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
|
||||
virDomainNetGetActualHostdev(detach));
|
||||
goto cleanup;
|
||||
}
|
||||
if (STREQLEN(vm->def->os.machine, "s390-ccw", 8) &&
|
||||
if (qemuDomainMachineIsS390CCW(vm->def) &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
if (!virDomainDeviceAddressIsValid(&detach->info,
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user