提交 647bc753 编写于 作者: J John Ferlan

qemu: Introduce qemuAliasFromHostdev

Introduce a common API to generate the alias for a host device
上级 97ca6eed
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册