Add 'FromCache' to virDomainVirtioSerialAddrAutoAssign

Commit 19a148b dropped the cache from QEMU's private domain object.
Assume the callers do not have the cache by default and use
a longer name for the internal ones that do.

This makes the shorter 'virDomainVirtioSerialAddrAutoAssign'
name availabe for a function that will not require the cache.
This commit is contained in:
Ján Tomko 2016-10-21 12:58:54 +02:00
parent eacecd7437
commit 0512dd26ee
5 changed files with 17 additions and 15 deletions

View File

@ -1188,10 +1188,10 @@ virDomainVirtioSerialAddrNextFromController(virDomainVirtioSerialAddrSetPtr addr
* or assign a virtio serial address to the device
*/
int
virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def,
virDomainVirtioSerialAddrSetPtr addrs,
virDomainDeviceInfoPtr info,
bool allowZero)
virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def,
virDomainVirtioSerialAddrSetPtr addrs,
virDomainDeviceInfoPtr info,
bool allowZero)
{
bool portOnly = info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL;
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&

View File

@ -224,10 +224,10 @@ virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def)
bool
virDomainVirtioSerialAddrIsComplete(virDomainDeviceInfoPtr info);
int
virDomainVirtioSerialAddrAutoAssign(virDomainDefPtr def,
virDomainVirtioSerialAddrSetPtr addrs,
virDomainDeviceInfoPtr info,
bool allowZero)
virDomainVirtioSerialAddrAutoAssignFromCache(virDomainDefPtr def,
virDomainVirtioSerialAddrSetPtr addrs,
virDomainDeviceInfoPtr info,
bool allowZero)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int

View File

@ -123,7 +123,7 @@ virDomainUSBAddressSetAddHub;
virDomainUSBAddressSetCreate;
virDomainUSBAddressSetFree;
virDomainVirtioSerialAddrAssign;
virDomainVirtioSerialAddrAutoAssign;
virDomainVirtioSerialAddrAutoAssignFromCache;
virDomainVirtioSerialAddrIsComplete;
virDomainVirtioSerialAddrRelease;
virDomainVirtioSerialAddrReserve;

View File

@ -122,7 +122,8 @@ qemuDomainAssignVirtioSerialAddresses(virDomainDefPtr def)
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO &&
!virDomainVirtioSerialAddrIsComplete(&chr->info) &&
virDomainVirtioSerialAddrAutoAssign(def, addrs, &chr->info, true) < 0)
virDomainVirtioSerialAddrAutoAssignFromCache(def, addrs,
&chr->info, true) < 0)
goto cleanup;
}
@ -131,7 +132,8 @@ qemuDomainAssignVirtioSerialAddresses(virDomainDefPtr def)
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
!virDomainVirtioSerialAddrIsComplete(&chr->info) &&
virDomainVirtioSerialAddrAutoAssign(def, addrs, &chr->info, false) < 0)
virDomainVirtioSerialAddrAutoAssignFromCache(def, addrs,
&chr->info, false) < 0)
goto cleanup;
}

View File

@ -1770,8 +1770,8 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObjPtr vm,
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
if (virDomainVirtioSerialAddrAutoAssign(NULL, vioaddrs,
&chr->info, true) < 0)
if (virDomainVirtioSerialAddrAutoAssignFromCache(NULL, vioaddrs,
&chr->info, true) < 0)
goto cleanup;
ret = 1;
@ -1789,8 +1789,8 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObjPtr vm,
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
if (virDomainVirtioSerialAddrAutoAssign(NULL, vioaddrs,
&chr->info, false) < 0)
if (virDomainVirtioSerialAddrAutoAssignFromCache(NULL, vioaddrs,
&chr->info, false) < 0)
goto cleanup;
ret = 1;
}