conf: Reintroduce action to virDomainDefCompatibleDevice

This was lost in c57f3fd2f8. But now we are going to
need it again (except the DETACH action where checking for device
compatibility does not make much sense anyway).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Michal Privoznik 2018-06-26 10:37:27 +02:00
parent 84de7fbfdb
commit 5e9b150fe0
4 changed files with 26 additions and 13 deletions

View File

@ -28205,7 +28205,8 @@ virDomainDeviceInfoCheckBootIndex(virDomainDefPtr def ATTRIBUTE_UNUSED,
int
virDomainDefCompatibleDevice(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
virDomainDeviceDefPtr oldDev)
virDomainDeviceDefPtr oldDev,
virDomainDeviceAction action ATTRIBUTE_UNUSED)
{
virDomainCompatibleDeviceData data = {
.newInfo = virDomainDeviceGetInfo(dev),

View File

@ -3106,7 +3106,8 @@ typedef enum {
int virDomainDefCompatibleDevice(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
virDomainDeviceDefPtr oldDev);
virDomainDeviceDefPtr oldDev,
virDomainDeviceAction action);
void virDomainRNGDefFree(virDomainRNGDefPtr def);

View File

@ -3521,7 +3521,8 @@ lxcDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
goto cleanup;
oldDev.data.net = vmdef->nets[idx];
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
return -1;
virDomainNetDefFree(vmdef->nets[idx]);
@ -4757,7 +4758,8 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
if (!vmdef)
goto endjob;
if (virDomainDefCompatibleDevice(vmdef, dev, NULL) < 0)
if (virDomainDefCompatibleDevice(vmdef, dev, NULL,
VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0)
goto endjob;
if ((ret = lxcDomainAttachDeviceConfig(vmdef, dev)) < 0)
@ -4765,7 +4767,8 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (virDomainDefCompatibleDevice(vm->def, dev_copy, NULL) < 0)
if (virDomainDefCompatibleDevice(vm->def, dev_copy, NULL,
VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0)
goto endjob;
if ((ret = lxcDomainAttachDeviceLive(dom->conn, driver, vm, dev_copy)) < 0)

View File

@ -7860,7 +7860,8 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm,
}
oldDev.data.disk = orig_disk;
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
goto cleanup;
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
@ -7918,7 +7919,8 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_GRAPHICS:
if ((idx = qemuDomainFindGraphicsIndex(vm->def, dev->data.graphics)) >= 0) {
oldDev.data.graphics = vm->def->graphics[idx];
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
return -1;
}
@ -7928,7 +7930,8 @@ qemuDomainUpdateDeviceLive(virDomainObjPtr vm,
case VIR_DOMAIN_DEVICE_NET:
if ((idx = virDomainNetFindIdx(vm->def, dev->data.net)) >= 0) {
oldDev.data.net = vm->def->nets[idx];
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vm->def, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
return -1;
}
@ -8381,7 +8384,8 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
}
oldDev.data.disk = vmdef->disks[pos];
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
return -1;
virDomainDiskDefFree(vmdef->disks[pos]);
@ -8400,7 +8404,8 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
}
oldDev.data.graphics = vmdef->graphics[pos];
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
return -1;
virDomainGraphicsDefFree(vmdef->graphics[pos]);
@ -8414,7 +8419,8 @@ qemuDomainUpdateDeviceConfig(virDomainDefPtr vmdef,
return -1;
oldDev.data.net = vmdef->nets[pos];
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev) < 0)
if (virDomainDefCompatibleDevice(vmdef, dev, &oldDev,
VIR_DOMAIN_DEVICE_ACTION_UPDATE) < 0)
return -1;
virDomainNetDefFree(vmdef->nets[pos]);
@ -8505,7 +8511,8 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
if (!vmdef)
goto cleanup;
if (virDomainDefCompatibleDevice(vmdef, dev, NULL) < 0)
if (virDomainDefCompatibleDevice(vmdef, dev, NULL,
VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0)
goto cleanup;
if ((ret = qemuDomainAttachDeviceConfig(vmdef, dev, caps,
parse_flags,
@ -8514,7 +8521,8 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
}
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (virDomainDefCompatibleDevice(vm->def, dev_copy, NULL) < 0)
if (virDomainDefCompatibleDevice(vm->def, dev_copy, NULL,
VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0)
goto cleanup;
if ((ret = qemuDomainAttachDeviceLive(vm, dev_copy, driver)) < 0)