qemu: command: remove qemuDomainFSDriver

Having a translation enum full of empty strings seems excessive.
Now that the validiation is performed in qemuDomainDeviceDefValidateFS,
remove it completely and open-code the two allowed cases.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Ján Tomko 2019-07-16 12:31:03 +02:00
parent e6e7c41f84
commit 898821cce8

View File

@ -179,17 +179,6 @@ VIR_ENUM_IMPL(qemuControllerModelUSB,
"none",
);
VIR_ENUM_DECL(qemuDomainFSDriver);
VIR_ENUM_IMPL(qemuDomainFSDriver,
VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
"local",
"local",
"handle",
NULL,
NULL,
NULL,
);
VIR_ENUM_DECL(qemuNumaPolicy);
VIR_ENUM_IMPL(qemuNumaPolicy,
VIR_DOMAIN_NUMATUNE_MEM_LAST,
@ -2704,13 +2693,11 @@ static char *
qemuBuildFSStr(virDomainFSDefPtr fs)
{
VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
const char *driver = qemuDomainFSDriverTypeToString(fs->fsdriver);
const char *wrpolicy = virDomainFSWrpolicyTypeToString(fs->wrpolicy);
virBufferAdd(&opt, driver, -1);
if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_PATH ||
fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
virBufferAddLit(&opt, "local");
if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
virBufferAddLit(&opt, ",security_model=mapped");
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
@ -2718,6 +2705,9 @@ qemuBuildFSStr(virDomainFSDefPtr fs)
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
virBufferAddLit(&opt, ",security_model=none");
}
} else if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE) {
/* removed since qemu 4.0.0 see v3.1.0-29-g93aee84f57 */
virBufferAddLit(&opt, "handle");
}
if (fs->wrpolicy)