virt-manager/SOURCES/virt-manager-cli-filesystem...

94 lines
4.5 KiB
Diff

From 5c16353a007fd7f18eb44a7413d0c146b7de1a4c Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Fri, 30 Jul 2021 13:15:29 -0400
Subject: [PATCH] cli: --filesystem: add binary.sandbox.mode and source.socket
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 520b3a3b35359ddd07f3a818d6cc3e6740079eff)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045932
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
---
tests/data/cli/compare/virt-install-many-devices.xml | 5 ++++-
tests/test_cli.py | 2 +-
virtinst/cli.py | 2 ++
virtinst/devices/filesystem.py | 2 ++
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml
index 3bd756b3..417d8db0 100644
--- a/tests/data/cli/compare/virt-install-many-devices.xml
+++ b/tests/data/cli/compare/virt-install-many-devices.xml
@@ -293,11 +293,14 @@
<readonly/>
<space_hard_limit>1234</space_hard_limit>
<space_soft_limit>500</space_soft_limit>
- <source pool="pool1" volume="vol"/>
+ <source pool="pool1" volume="vol">
+ <socket>/tmp/foo.sock</socket>
+ </source>
<target dir="/foo"/>
<binary path="/foo/virtiofsd" xattr="off">
<cache mode="always"/>
<lock posix="off" flock="on"/>
+ <sandbox mode="chroot"/>
</binary>
<driver name="virtiofs" queue="3"/>
</filesystem>
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 2034d21c..862d19dd 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -686,7 +686,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--filesystem type-mount,source.dir=/,target=/
--filesystem type=template,source.name=foo,target=/
--filesystem type=file,source.file=foo.img,target=/
---filesystem type=volume,model=virtio,multidevs=remap,readonly=on,space_hard_limit=1234,space_soft_limit=500,source.pool=pool1,source.volume=vol,driver.name=virtiofs,driver.queue=3,binary.path=/foo/virtiofsd,binary.xattr=off,binary.cache.mode=always,binary.lock.posix=off,binary.lock.flock=on,target.dir=/foo
+--filesystem type=volume,model=virtio,multidevs=remap,readonly=on,space_hard_limit=1234,space_soft_limit=500,source.pool=pool1,source.volume=vol,driver.name=virtiofs,driver.queue=3,binary.path=/foo/virtiofsd,binary.xattr=off,binary.cache.mode=always,binary.lock.posix=off,binary.lock.flock=on,target.dir=/foo,binary.sandbox.mode=chroot,source.socket=/tmp/foo.sock
--filesystem type=block,source.dev=/dev/foo,target.dir=/
--filesystem type=ram,source.usage=1024,source.units=MiB,target=/
diff --git a/virtinst/cli.py b/virtinst/cli.py
index dbd4a545..13782fc8 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -4225,6 +4225,7 @@ class ParserFilesystem(VirtCLIParser):
cls.add_arg("source.volume", "source_volume")
cls.add_arg("source.units", "source_units")
cls.add_arg("source.usage", "source_usage")
+ cls.add_arg("source.socket", "source_socket")
cls.add_arg("target.dir", "target_dir")
@@ -4233,6 +4234,7 @@ class ParserFilesystem(VirtCLIParser):
cls.add_arg("binary.cache.mode", "binary_cache_mode")
cls.add_arg("binary.lock.posix", "binary_lock_posix", is_onoff=True)
cls.add_arg("binary.lock.flock", "binary_lock_flock", is_onoff=True)
+ cls.add_arg("binary.sandbox.mode", "binary_sandbox_mode")
cls.add_arg("driver.format", "driver_format")
cls.add_arg("driver.name", "driver_name")
diff --git a/virtinst/devices/filesystem.py b/virtinst/devices/filesystem.py
index 574844b6..02402bac 100644
--- a/virtinst/devices/filesystem.py
+++ b/virtinst/devices/filesystem.py
@@ -49,12 +49,14 @@ class DeviceFilesystem(Device):
source_units = XMLProperty("./source/@units")
source_pool = XMLProperty("./source/@pool")
source_volume = XMLProperty("./source/@volume")
+ source_socket = XMLProperty("./source/socket")
binary_path = XMLProperty("./binary/@path")
binary_xattr = XMLProperty("./binary/@xattr", is_onoff=True)
binary_cache_mode = XMLProperty("./binary/cache/@mode")
binary_lock_posix = XMLProperty("./binary/lock/@posix", is_onoff=True)
binary_lock_flock = XMLProperty("./binary/lock/@flock", is_onoff=True)
+ binary_sandbox_mode = XMLProperty("./binary/sandbox/@mode")
def _type_to_source_prop(self):
if self.type == DeviceFilesystem.TYPE_TEMPLATE:
--
2.34.1