1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

conf: Keep 'readonly' property when resetting disk source

The property is necessary also for the disk using the source (e.g. cdrom)
which needs to be kept readonly.

Commit '462c4b66' was a bit too aggressive in this aspect, since the
readonly flag is set only while parsing.
This commit is contained in:
Peter Krempa 2017-04-07 13:44:54 +02:00
parent b003b9781b
commit 7526a71586

View File

@ -1723,9 +1723,12 @@ void
virDomainDiskEmptySource(virDomainDiskDefPtr def)
{
virStorageSourcePtr src = def->src;
bool readonly = src->readonly;
virStorageSourceClear(src);
src->type = VIR_STORAGE_TYPE_FILE;
/* readonly property is necessary for CDROMs and thus can't be cleared */
src->readonly = readonly;
}