mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemuBlockStorageSourceGetBackendProps: Remove unused logic for (auto-)read-only flags
The code was refactored to format the 'read-only' and 'auto-read-only' flags via the common helper, so the logic determining their values can be removed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
fc18e01e52
commit
620ef445ce
@ -807,9 +807,7 @@ qemuBlockStorageSourceGetSshProps(virStorageSource *src)
|
||||
|
||||
static virJSONValue *
|
||||
qemuBlockStorageSourceGetFileProps(virStorageSource *src,
|
||||
bool onlytarget,
|
||||
virTristateBool *autoReadOnly,
|
||||
virTristateBool *readOnly)
|
||||
bool onlytarget)
|
||||
{
|
||||
const char *path = src->path;
|
||||
const char *iomode = NULL;
|
||||
@ -825,25 +823,8 @@ qemuBlockStorageSourceGetFileProps(virStorageSource *src,
|
||||
if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
|
||||
iomode = virDomainDiskIoTypeToString(src->iomode);
|
||||
|
||||
if (srcpriv && srcpriv->fdpass) {
|
||||
if (srcpriv && srcpriv->fdpass)
|
||||
path = qemuFDPassGetPath(srcpriv->fdpass);
|
||||
|
||||
/* when passing a FD to qemu via the /dev/fdset mechanism qemu
|
||||
* fetches the appropriate FD from the fdset by checking that it has
|
||||
* the correct accessmode. Now with 'auto-read-only' in effect qemu
|
||||
* wants to use a read-only FD first. If the user didn't pass multiple
|
||||
* FDs the feature will not work regardless, so we'll disable it. */
|
||||
if (src->fdtuple->nfds == 1) {
|
||||
*autoReadOnly = VIR_TRISTATE_BOOL_ABSENT;
|
||||
|
||||
/* now we setup the normal readonly flag. If user requested write
|
||||
* access honour it */
|
||||
if (src->fdtuple->writable)
|
||||
*readOnly = VIR_TRISTATE_BOOL_NO;
|
||||
else
|
||||
*readOnly = virTristateBoolFromBool(src->readonly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ignore_value(virJSONValueObjectAdd(&ret,
|
||||
@ -1044,20 +1025,9 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src,
|
||||
virStorageType actualType = virStorageSourceGetActualType(src);
|
||||
g_autoptr(virJSONValue) fileprops = NULL;
|
||||
const char *driver = NULL;
|
||||
virTristateBool aro = VIR_TRISTATE_BOOL_ABSENT;
|
||||
virTristateBool ro = VIR_TRISTATE_BOOL_ABSENT;
|
||||
bool onlytarget = flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_TARGET_ONLY;
|
||||
bool legacy = flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY;
|
||||
|
||||
if (flags & QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_AUTO_READONLY) {
|
||||
aro = VIR_TRISTATE_BOOL_YES;
|
||||
} else {
|
||||
if (src->readonly)
|
||||
ro = VIR_TRISTATE_BOOL_YES;
|
||||
else
|
||||
ro = VIR_TRISTATE_BOOL_NO;
|
||||
}
|
||||
|
||||
switch (actualType) {
|
||||
case VIR_STORAGE_TYPE_BLOCK:
|
||||
case VIR_STORAGE_TYPE_FILE:
|
||||
@ -1070,7 +1040,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource *src,
|
||||
driver = "file";
|
||||
}
|
||||
|
||||
if (!(fileprops = qemuBlockStorageSourceGetFileProps(src, onlytarget, &aro, &ro)))
|
||||
if (!(fileprops = qemuBlockStorageSourceGetFileProps(src, onlytarget)))
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user