mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
Introduce virDomainVirtioSerialAddrAutoAssign again
This time do not require an address cache as a parameter.
Simplify qemuDomainAttachChrDeviceAssignAddr to not generate
the virtio serial address cache for devices of other types.
Partially reverts commit 925fa4b
.
This commit is contained in:
parent
0512dd26ee
commit
ac518960a6
@ -1201,6 +1201,27 @@ virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def,
|
|||||||
return virDomainVirtioSerialAddrAssign(def, addrs, info, allowZero, portOnly);
|
return virDomainVirtioSerialAddrAssign(def, addrs, info, allowZero, portOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def,
|
||||||
|
virDomainDeviceInfoPtr info,
|
||||||
|
bool allowZero)
|
||||||
|
{
|
||||||
|
virDomainVirtioSerialAddrSetPtr addrs = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if (!(addrs = virDomainVirtioSerialAddrSetCreateFromDomain(def)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainVirtioSerialAddrAutoAssignFromCache(def, addrs, info, allowZero) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virDomainVirtioSerialAddrSetFree(addrs);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
|
virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
|
||||||
|
@ -230,6 +230,12 @@ virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def,
|
|||||||
bool allowZero)
|
bool allowZero)
|
||||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||||
|
|
||||||
|
int
|
||||||
|
virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def,
|
||||||
|
virDomainDeviceInfoPtr info,
|
||||||
|
bool allowZero)
|
||||||
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int
|
int
|
||||||
virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
|
virDomainVirtioSerialAddrAssign(virDomainDefPtr def,
|
||||||
virDomainVirtioSerialAddrSetPtr addrs,
|
virDomainVirtioSerialAddrSetPtr addrs,
|
||||||
|
@ -123,6 +123,7 @@ virDomainUSBAddressSetAddHub;
|
|||||||
virDomainUSBAddressSetCreate;
|
virDomainUSBAddressSetCreate;
|
||||||
virDomainUSBAddressSetFree;
|
virDomainUSBAddressSetFree;
|
||||||
virDomainVirtioSerialAddrAssign;
|
virDomainVirtioSerialAddrAssign;
|
||||||
|
virDomainVirtioSerialAddrAutoAssign;
|
||||||
virDomainVirtioSerialAddrAutoAssignFromCache;
|
virDomainVirtioSerialAddrAutoAssignFromCache;
|
||||||
virDomainVirtioSerialAddrIsComplete;
|
virDomainVirtioSerialAddrIsComplete;
|
||||||
virDomainVirtioSerialAddrRelease;
|
virDomainVirtioSerialAddrRelease;
|
||||||
|
@ -1763,15 +1763,10 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObjPtr vm,
|
|||||||
virDomainDefPtr def = vm->def;
|
virDomainDefPtr def = vm->def;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virDomainVirtioSerialAddrSetPtr vioaddrs = NULL;
|
|
||||||
|
|
||||||
if (!(vioaddrs = virDomainVirtioSerialAddrSetCreateFromDomain(def)))
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
||||||
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
|
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
|
||||||
if (virDomainVirtioSerialAddrAutoAssignFromCache(NULL, vioaddrs,
|
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, true) < 0)
|
||||||
&chr->info, true) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
@ -1789,8 +1784,7 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObjPtr vm,
|
|||||||
|
|
||||||
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
||||||
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
|
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
|
||||||
if (virDomainVirtioSerialAddrAutoAssignFromCache(NULL, vioaddrs,
|
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, false) < 0)
|
||||||
&chr->info, false) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
@ -1808,7 +1802,6 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObjPtr vm,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainVirtioSerialAddrSetFree(vioaddrs);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user