Implement both commandline support and hotplug by adding the http cookie
handling to 'qemuBlockStorageSourceAttachData' handling functions for
it.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_block.c | 13 +++++++++++++
src/qemu/qemu_block.h | 3 +++
src/qemu/qemu_command.c | 5 +++++
3 files changed, 21 insertions(+)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6bfd46a489..aba0f31f94 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1499,11 +1499,13 @@
qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr data)
virJSONValueFree(data->formatProps);
virJSONValueFree(data->prmgrProps);
virJSONValueFree(data->authsecretProps);
+ virJSONValueFree(data->httpcookiesecretProps);
virJSONValueFree(data->encryptsecretProps);
virJSONValueFree(data->tlsProps);
VIR_FREE(data->tlsAlias);
VIR_FREE(data->authsecretAlias);
VIR_FREE(data->encryptsecretAlias);
+ VIR_FREE(data->httpcookiesecretAlias);
VIR_FREE(data->driveCmd);
VIR_FREE(data->driveAlias);
VIR_FREE(data);
@@ -1570,6 +1572,11 @@ qemuBlockStorageSourceAttachApplyStorageDeps(qemuMonitorPtr mon,
&data->authsecretAlias) < 0)
return -1;
+ if (data->httpcookiesecretProps &&
+ qemuMonitorAddObject(mon, &data->httpcookiesecretProps,
+ &data->httpcookiesecretAlias) < 0)
+ return -1;
+
if (data->tlsProps &&
qemuMonitorAddObject(mon, &data->tlsProps, &data->tlsAlias) <
0)
return -1;
@@ -1713,6 +1720,9 @@ qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon,
if (data->encryptsecretAlias)
ignore_value(qemuMonitorDelObject(mon, data->encryptsecretAlias));
+ if (data->httpcookiesecretAlias)
+ ignore_value(qemuMonitorDelObject(mon, data->httpcookiesecretAlias));
+
if (data->tlsAlias)
ignore_value(qemuMonitorDelObject(mon, data->tlsAlias));
@@ -1768,6 +1778,9 @@ qemuBlockStorageSourceDetachPrepare(virStorageSourcePtr src,
if (srcpriv->encinfo && srcpriv->encinfo->type ==
VIR_DOMAIN_SECRET_INFO_TYPE_AES)
data->encryptsecretAlias = g_strdup(srcpriv->encinfo->s.aes.alias);
+
+ if (srcpriv->httpcookie)
+ data->httpcookiesecretAlias =
g_strdup(srcpriv->httpcookie->s.aes.alias);
}
return g_steal_pointer(&data);
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index eab0128d5d..197f5dae97 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -100,6 +100,9 @@ struct qemuBlockStorageSourceAttachData {
virJSONValuePtr encryptsecretProps;
char *encryptsecretAlias;
+ virJSONValuePtr httpcookiesecretProps;
+ char *httpcookiesecretAlias;
+
virJSONValuePtr tlsProps;
char *tlsAlias;
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9e0334a3e7..9790c92cf8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2398,6 +2398,7 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommandPtr cmd,
if (qemuBuildObjectCommandline(cmd, data->prmgrProps) < 0 ||
qemuBuildObjectCommandline(cmd, data->authsecretProps) < 0 ||
qemuBuildObjectCommandline(cmd, data->encryptsecretProps) < 0 ||
+ qemuBuildObjectCommandline(cmd, data->httpcookiesecretProps) < 0 ||
qemuBuildObjectCommandline(cmd, data->tlsProps) < 0)
return -1;
@@ -10333,6 +10334,10 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSourcePtr
src,
if (srcpriv->encinfo &&
qemuBuildSecretInfoProps(srcpriv->encinfo,
&data->encryptsecretProps) < 0)
return -1;
+
+ if (srcpriv->httpcookie &&
+ qemuBuildSecretInfoProps(srcpriv->httpcookie,
&data->httpcookiesecretProps) < 0)
+ return -1;
}
if (src->haveTLS == VIR_TRISTATE_BOOL_YES &&
--
2.24.1