The device path will be necessary for any future patch to allow sgio settings on a hostdev
Signed-off-by: John Ferlan <jfer...@redhat.com> --- src/qemu/qemu_conf.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 8afbddc..80b8926 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1263,20 +1263,14 @@ qemuGetHostdevPath(virDomainHostdevDefPtr hostdev) static char * -qemuGetSharedHostdevKey(virDomainHostdevDefPtr hostdev) +qemuGetSharedHostdevKey(const char *dev_path) { char *key = NULL; - char *dev_path = NULL; - - if (!(dev_path = qemuGetHostdevPath(hostdev))) - goto cleanup; if (!(key = qemuGetSharedDeviceKey(dev_path))) goto cleanup; cleanup: - VIR_FREE(dev_path); - return key; } @@ -1285,6 +1279,7 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver, virDomainHostdevDefPtr hostdev, const char *name) { + char *dev_path = NULL; char *key = NULL; int ret = -1; @@ -1293,7 +1288,10 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver, qemuDriverLock(driver); - if (!(key = qemuGetSharedHostdevKey(hostdev))) + if (!(dev_path = qemuGetHostdevPath(hostdev))) + goto cleanup; + + if (!(key = qemuGetSharedHostdevKey(dev_path))) goto cleanup; if (qemuSharedDeviceEntryInsert(driver, key, name) < 0) @@ -1303,6 +1301,7 @@ qemuAddSharedHostdev(virQEMUDriverPtr driver, cleanup: qemuDriverUnlock(driver); + VIR_FREE(dev_path); VIR_FREE(key); return ret; } @@ -1391,6 +1390,7 @@ qemuRemoveSharedHostdev(virQEMUDriverPtr driver, virDomainHostdevDefPtr hostdev, const char *name) { + char *dev_path = NULL; char *key = NULL; int ret = -1; @@ -1399,7 +1399,10 @@ qemuRemoveSharedHostdev(virQEMUDriverPtr driver, qemuDriverLock(driver); - if (!(key = qemuGetSharedHostdevKey(hostdev))) + if (!(dev_path = qemuGetHostdevPath(hostdev))) + goto cleanup; + + if (!(key = qemuGetSharedHostdevKey(dev_path))) goto cleanup; if (qemuSharedDeviceEntryRemove(driver, key, name) < 0) @@ -1408,6 +1411,7 @@ qemuRemoveSharedHostdev(virQEMUDriverPtr driver, ret = 0; cleanup: qemuDriverUnlock(driver); + VIR_FREE(dev_path); VIR_FREE(key); return ret; } -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list