mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu: Introduce helper qemuDomainSecretDiskCapable
Introduce a helper to help determine if a disk src could be possibly used for a disk secret... Going to need this for hot unplug. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
2552fec248
commit
60c40ce3be
@ -972,6 +972,20 @@ qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainSecretDiskCapable(virStorageSourcePtr src)
|
||||||
|
{
|
||||||
|
if (!virStorageSourceIsEmpty(src) &&
|
||||||
|
virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_NETWORK &&
|
||||||
|
src->auth &&
|
||||||
|
(src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI ||
|
||||||
|
src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* qemuDomainSecretDiskPrepare:
|
/* qemuDomainSecretDiskPrepare:
|
||||||
* @conn: Pointer to connection
|
* @conn: Pointer to connection
|
||||||
* @priv: pointer to domain private object
|
* @priv: pointer to domain private object
|
||||||
@ -989,11 +1003,7 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
|
|||||||
virStorageSourcePtr src = disk->src;
|
virStorageSourcePtr src = disk->src;
|
||||||
qemuDomainSecretInfoPtr secinfo = NULL;
|
qemuDomainSecretInfoPtr secinfo = NULL;
|
||||||
|
|
||||||
if (conn && !virStorageSourceIsEmpty(src) &&
|
if (conn && qemuDomainSecretDiskCapable(src)) {
|
||||||
virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_NETWORK &&
|
|
||||||
src->auth &&
|
|
||||||
(src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI ||
|
|
||||||
src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)) {
|
|
||||||
|
|
||||||
virSecretUsageType secretUsageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
virSecretUsageType secretUsageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
||||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
|
@ -670,6 +670,9 @@ void qemuDomainMasterKeyRemove(qemuDomainObjPrivatePtr priv);
|
|||||||
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
|
void qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
|
bool qemuDomainSecretDiskCapable(virStorageSourcePtr src)
|
||||||
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
int qemuDomainSecretDiskPrepare(virConnectPtr conn,
|
int qemuDomainSecretDiskPrepare(virConnectPtr conn,
|
||||||
qemuDomainObjPrivatePtr priv,
|
qemuDomainObjPrivatePtr priv,
|
||||||
virDomainDiskDefPtr disk)
|
virDomainDiskDefPtr disk)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user