mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: Introduce qemuAliasFromHostdev
Introduce a common API to generate the alias for a host device
This commit is contained in:
parent
97ca6eed9a
commit
647bc753d4
@ -493,6 +493,29 @@ qemuAliasDiskDriveSkipPrefix(const char *dev_name)
|
||||
}
|
||||
|
||||
|
||||
/* qemuAliasFromHostdev
|
||||
* @hostdev: Pointer to host device
|
||||
*
|
||||
* Generate and return a string containing a drive alias
|
||||
*/
|
||||
char *
|
||||
qemuAliasFromHostdev(const virDomainHostdevDef *hostdev)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
if (!hostdev->info->alias) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("hostdev does not have an alias"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ignore_value(virAsprintf(&ret, "%s-%s",
|
||||
virDomainDeviceAddressTypeToString(hostdev->info->type),
|
||||
hostdev->info->alias));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* qemuDomainGetMasterKeyAlias:
|
||||
*
|
||||
* Generate and return the masterKey alias
|
||||
|
@ -69,6 +69,8 @@ char *qemuAliasFromDisk(const virDomainDiskDef *disk);
|
||||
|
||||
const char *qemuAliasDiskDriveSkipPrefix(const char *dev_name);
|
||||
|
||||
char *qemuAliasFromHostdev(const virDomainHostdevDef *hostdev);
|
||||
|
||||
char *qemuDomainGetMasterKeyAlias(void);
|
||||
|
||||
char *qemuDomainGetSecretAESAlias(const char *srcalias,
|
||||
|
Loading…
Reference in New Issue
Block a user