devicefilesystem: Rename mode->accessmode

To reflect the name in the XML
This commit is contained in:
Cole Robinson 2015-09-20 20:15:34 -04:00
parent a9aca96458
commit 6a9f0089b9
6 changed files with 16 additions and 14 deletions

View File

@ -153,7 +153,7 @@
<source dir="/source"/>
<target dir="/target"/>
</filesystem>
<filesystem type="template">
<filesystem type="template" accessmode="passthrough">
<source name="template_name"/>
<target dir="/"/>
</filesystem>

View File

@ -498,8 +498,8 @@ c.add_compare(""" \
--hostdev usb_5_20 --hostdev usb_5_21 \
\
--filesystem /source,/target,mode=squash \
--filesystem template_name,/,type=template \
--filesystem /source,/target,accessmode=squash \
--filesystem template_name,/,type=template,mode=passthrough \
\
--soundhw default \
--sound ac97 \

View File

@ -743,7 +743,7 @@ class XMLParseTest(unittest.TestCase):
check = self._make_checker(dev1)
check("type", None, "mount")
check("mode", None, "passthrough")
check("accessmode", None, "passthrough")
check("driver", "handle", None)
check("wrpolicy", None, None)
check("source", "/foo/bar", "/new/path")
@ -751,20 +751,20 @@ class XMLParseTest(unittest.TestCase):
check = self._make_checker(dev2)
check("type", "template")
check("mode", None, "mapped")
check("accessmode", None, "mapped")
check("source", "template_fedora", "template_new")
check("target", "/bar/baz")
check = self._make_checker(dev3)
check("type", "mount", None)
check("mode", "squash", None)
check("accessmode", "squash", None)
check("driver", "path", "handle")
check("wrpolicy", "immediate", None)
check("readonly", False, True)
check = self._make_checker(dev4)
check("type", "mount", None)
check("mode", "mapped", None)
check("accessmode", "mapped", None)
check("driver", "path", "handle")
check("wrpolicy", None, "immediate")
check("readonly", False, True)
@ -781,7 +781,7 @@ class XMLParseTest(unittest.TestCase):
check = self._make_checker(dev7)
check("type", "file")
check("mode", "passthrough", None)
check("accessmode", "passthrough", None)
check("driver", "nbd", "loop")
check("format", "qcow", "raw")
check("source", "/foo/bar.img", "/foo/bar.raw")

View File

@ -182,7 +182,7 @@ class vmmFSDetails(vmmGObjectUI):
self._dev = dev
self.set_config_value("fs-type", dev.type or "default")
self.set_config_value("fs-mode", dev.mode or "default")
self.set_config_value("fs-mode", dev.accessmode or "default")
self.set_config_value("fs-driver", dev.driver or "default")
self.set_config_value("fs-wrpolicy", dev.wrpolicy or "default")
self.set_config_value("fs-format", dev.format or "default")
@ -308,7 +308,7 @@ class vmmFSDetails(vmmGObjectUI):
self._dev.source = source
self._dev.target = target
if mode:
self._dev.mode = mode
self._dev.accessmode = mode
if fstype:
self._dev.type = fstype
if readonly:

View File

@ -2198,7 +2198,7 @@ class ParserFilesystem(VirtCLIParser):
self.remove_first = ["source", "target"]
self.set_param("type", "type")
self.set_param("mode", "mode")
self.set_param("accessmode", "accessmode", aliases=["mode"])
self.set_param("source", "source")
self.set_param("target", "target")

View File

@ -32,7 +32,8 @@ class VirtualFilesystem(VirtualDevice):
TYPE_BLOCK = "block"
TYPE_RAM = "ram"
TYPE_DEFAULT = "default"
TYPES = [TYPE_MOUNT, TYPE_TEMPLATE, TYPE_FILE, TYPE_BLOCK, TYPE_RAM, TYPE_DEFAULT]
TYPES = [TYPE_MOUNT, TYPE_TEMPLATE, TYPE_FILE, TYPE_BLOCK, TYPE_RAM,
TYPE_DEFAULT]
MODE_PASSTHROUGH = "passthrough"
MODE_MAPPED = "mapped"
@ -49,13 +50,14 @@ class VirtualFilesystem(VirtualDevice):
DRIVER_LOOP = "loop"
DRIVER_NBD = "nbd"
DRIVER_DEFAULT = "default"
DRIVERS = [DRIVER_PATH, DRIVER_HANDLE, DRIVER_LOOP, DRIVER_NBD, DRIVER_DEFAULT]
DRIVERS = [DRIVER_PATH, DRIVER_HANDLE, DRIVER_LOOP, DRIVER_NBD,
DRIVER_DEFAULT]
type = XMLProperty("./@type",
default_cb=lambda s: None,
default_name=TYPE_DEFAULT)
mode = XMLProperty("./@accessmode",
accessmode = XMLProperty("./@accessmode",
default_cb=lambda s: None,
default_name=MODE_DEFAULT)
wrpolicy = XMLProperty("./driver/@wrpolicy",