Move the default setting of accessmode to the post-parse phase.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/conf/domain_conf.c | 18 ++++++++++++++++--
src/conf/domain_conf.h | 1 +
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d050a519c6..3c3e381de2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -504,6 +504,7 @@ VIR_ENUM_IMPL(virDomainFSDriver,
VIR_ENUM_IMPL(virDomainFSAccessMode,
VIR_DOMAIN_FS_ACCESSMODE_LAST,
+ "",
"passthrough",
"mapped",
"squash",
@@ -5486,6 +5487,16 @@ virDomainMemoryDefPostParse(virDomainMemoryDefPtr mem,
}
+static int
+virDomainFSDefPostParse(virDomainFSDefPtr fs)
+{
+ if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_DEFAULT)
+ fs->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH;
+
+ return 0;
+}
+
+
static int
virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
const virDomainDef *def,
@@ -5531,8 +5542,11 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
ret = virDomainMemoryDefPostParse(dev->data.memory, def);
break;
- case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
+ ret = virDomainFSDefPostParse(dev->data.fs);
+ break;
+
+ case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_NET:
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
@@ -10263,7 +10277,7 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error;
}
} else {
- def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH;
+ def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_DEFAULT;
}
fmode = virXMLPropString(node, "fmode");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0b8895bbdf..9c47df99f6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -802,6 +802,7 @@ typedef enum {
/* Filesystem mount access mode */
typedef enum {
+ VIR_DOMAIN_FS_ACCESSMODE_DEFAULT = 0,
VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH,
VIR_DOMAIN_FS_ACCESSMODE_MAPPED,
VIR_DOMAIN_FS_ACCESSMODE_SQUASH,
--
2.29.2