qemu: domain: Regenerate auth/enc secret aliases when restoring status XML

Previously we did not store the aliases but rather re-generated them
when unplug was necessary. This is very cumbersome since the knowledge
when and which alias to use needs to be stored in the hotplug code as
well.

While this patch will not strictly improve this situation since there
still will be two places containing this code it at least will allow to
remove the mess from the disk-unplug code and will prevent introducing
more mess when adding blockdev support.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2018-05-24 18:24:13 +02:00
parent ecd785dd84
commit 7c6b00b8fe
2 changed files with 105 additions and 1 deletions

View File

@@ -317,6 +317,11 @@
<encryption format='luks'>
<secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
</encryption>
<privateData>
<objects>
<secret type='encryption' alias='virtio-disk1-luks-secret0'/>
</objects>
</privateData>
</source>
<backingStore/>
<target dev='vdb' bus='virtio'/>
@@ -350,6 +355,12 @@
<encryption format='luks'>
<secret type='passphrase' uuid='0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f'/>
</encryption>
<privateData>
<objects>
<secret type='auth' alias='virtio-disk3-secret0'/>
<secret type='encryption' alias='virtio-disk3-luks-secret0'/>
</objects>
</privateData>
</source>
<backingStore/>
<target dev='vdd' bus='virtio'/>
@@ -381,6 +392,11 @@
<auth username='testuser-rbd'>
<secret type='ceph' usage='testuser-rbd-secret'/>
</auth>
<privateData>
<objects>
<secret type='auth' alias='virtio-disk5-secret0'/>
</objects>
</privateData>
</source>
<backingStore/>
<target dev='vdf' bus='virtio'/>