On 07/19/2016 10:30 AM, John Ferlan wrote: > Introduce a common API to generate the alias for a SCSI Host device > > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> > --- > src/qemu/qemu_alias.c | 18 ++++++++++++++++++ > src/qemu/qemu_alias.h | 2 ++ > 2 files changed, 20 insertions(+) > Considering the other changes and for consistency, changing this to qemuAliasFromHostdev (to mimic qemuAliasFromDisk) seems appropriate. John > diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c > index d80537b..d8365ea 100644 > --- a/src/qemu/qemu_alias.c > +++ b/src/qemu/qemu_alias.c > @@ -190,6 +190,24 @@ qemuAssignDeviceDiskDriveAlias(const char *srcalias) > } > > > +/* qemuAssignSCSIHostDeviceDriveAlias(const char *srcalias) > + * @hostdev: Pointer to host device > + * > + * Generate and return a string containing a drive alias > + */ > +char * > +qemuAssignSCSIHostDeviceDriveAlias(virDomainHostdevDefPtr hostdev) > +{ > + char *ret; > + > + if (virAsprintf(&ret, "%s-%s", > + virDomainDeviceAddressTypeToString(hostdev->info->type), > + hostdev->info->alias) < 0) > + return NULL; > + return ret; > +} > + > + > /* qemuAliasDeviceDiskDriveSkipPrefix: > * @dev_name: Pointer to a const char string > * > diff --git a/src/qemu/qemu_alias.h b/src/qemu/qemu_alias.h > index b2acea5..d5d6fb5 100644 > --- a/src/qemu/qemu_alias.h > +++ b/src/qemu/qemu_alias.h > @@ -40,6 +40,8 @@ int qemuAssignDeviceControllerAlias(virDomainDefPtr domainDef, > > char *qemuAssignDeviceDiskDriveAlias(const char *srcalias); > > +char *qemuAssignSCSIHostDeviceDriveAlias(virDomainHostdevDefPtr hostdev); > + > const char *qemuAliasDeviceDiskDriveSkipPrefix(const char *dev_name); > > int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef, > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list