For use with blockdev the PR manager will be bound to a virStorageSource rather than a virDomainDiskDef, so we will need to use the correct alias. Allow passing a string rather than the whole disk. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_alias.c | 4 ++-- src/qemu/qemu_alias.h | 2 +- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_hotplug.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index bd714f7aee..578a33b284 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -783,11 +783,11 @@ qemuDomainGetManagedPRAlias(void) char * -qemuDomainGetUnmanagedPRAlias(const virDomainDiskDef *disk) +qemuDomainGetUnmanagedPRAlias(const char *parentalias) { char *ret; - ignore_value(virAsprintf(&ret, "pr-helper-%s", disk->info.alias)); + ignore_value(virAsprintf(&ret, "pr-helper-%s", parentalias)); return ret; } diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h index 76678658c0..51f64624d7 100644 --- a/src/qemu/qemu_alias.h +++ b/src/qemu/qemu_alias.h @@ -94,6 +94,6 @@ char *qemuAliasChardevFromDevAlias(const char *devAlias) const char *qemuDomainGetManagedPRAlias(void); -char *qemuDomainGetUnmanagedPRAlias(const virDomainDiskDef *disk); +char *qemuDomainGetUnmanagedPRAlias(const char *parentalias); #endif /* __QEMU_ALIAS_H__*/ diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 11ad77f145..24b482efd8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1482,7 +1482,7 @@ qemuBuildDriveSourcePR(virBufferPtr buf, if (virStoragePRDefIsManaged(disk->src->pr)) defaultAlias = qemuDomainGetManagedPRAlias(); - else if (!(alias = qemuDomainGetUnmanagedPRAlias(disk))) + else if (!(alias = qemuDomainGetUnmanagedPRAlias(disk->info.alias))) return -1; @@ -9705,7 +9705,7 @@ qemuBuildPRManagerInfoProps(virDomainObjPtr vm, if (VIR_STRDUP(alias, qemuDomainGetManagedPRAlias()) < 0) goto cleanup; } else { - if (!(alias = qemuDomainGetUnmanagedPRAlias(disk))) + if (!(alias = qemuDomainGetUnmanagedPRAlias(disk->info.alias))) goto cleanup; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1d748ccffb..52e1abdcd3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3842,7 +3842,7 @@ qemuDomainDiskNeedRemovePR(virDomainObjPtr vm, return 0; if (!virStoragePRDefIsManaged(disk->src->pr)) { - *aliasret = qemuDomainGetUnmanagedPRAlias(disk); + *aliasret = qemuDomainGetUnmanagedPRAlias(disk->info.alias); return *aliasret ? 0 : -1; } -- 2.16.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list