[virt-tools-list] [virt-manager PATCH] cli: Add --boot initdir, inituser, initgroup options

athina.plaskasoviti at gmail.com athina.plaskasoviti at gmail.com
Fri Aug 2 13:17:59 UTC 2019


From: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>

XML Mapping:

<os>
...
<initdir>X</initdir>
<inituser>X</inituser>
<initgroup>X</initgroup>
...
</os>

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti at gmail.com>
---
 .../compare/virt-install-singleton-config-2.xml             | 6 ++++++
 tests/clitest.py                                            | 2 +-
 virtinst/cli.py                                             | 3 +++
 virtinst/domain/os.py                                       | 4 ++++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
index cf03abec..0d202de8 100644
--- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
+++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml
@@ -90,6 +90,9 @@
   <os firmware="efi">
     <type arch="x86_64" machine="q35">hvm</type>
     <loader>/foo/bar</loader>
+    <initdir>/my/custom/cwd</initdir>
+    <inituser>tester</inituser>
+    <initgroup>1000</initgroup>
     <boot dev="network"/>
     <smbios mode="sysinfo"/>
     <bootmenu enable="no"/>
@@ -308,6 +311,9 @@
   <os firmware="efi">
     <type arch="x86_64" machine="q35">hvm</type>
     <loader>/foo/bar</loader>
+    <initdir>/my/custom/cwd</initdir>
+    <inituser>tester</inituser>
+    <initgroup>1000</initgroup>
     <boot dev="cdrom"/>
     <boot dev="fd"/>
     <boot dev="hd"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index c3d0297d..6818612d 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -516,7 +516,7 @@ cache.mode=emulate,cache.level=3
 --cputune vcpupin0.vcpu=0,vcpupin0.cpuset=0-3
 --iothreads iothreads=2,iothreadids.iothread1.id=1,iothreadids.iothread2.id=2
 --metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444,genid=e9392370-2917-565e-692b-d057f46512d6
---boot cdrom,fd,hd,network,menu=off,loader=/foo/bar,emulator=/new/emu,bootloader=/new/bootld,rebootTimeout=3,initargs="foo=bar baz=woo",firmware=efi
+--boot cdrom,fd,hd,network,menu=off,loader=/foo/bar,emulator=/new/emu,bootloader=/new/bootld,rebootTimeout=3,initargs="foo=bar baz=woo",initdir=/my/custom/cwd,inituser=tester,initgroup=1000,firmware=efi
 --idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10
 --seclabel type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes,baselabel=baselabel
 --seclabel type=dynamic,label=012:345
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 77d38c69..0affe513 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2343,6 +2343,9 @@ class ParserBoot(VirtCLIParser):
         cls.add_arg("initargs", "initargs", cb=cls.set_initargs_cb)
         cls.add_arg("initarg[0-9]*", "val",
                     find_inst_cb=cls.initarg_find_inst_cb)
+        cls.add_arg("initdir", "initdir")
+        cls.add_arg("inituser", "inituser")
+        cls.add_arg("initgroup", "initgroup")
         cls.add_arg("loader", "loader")
         cls.add_arg("loader.readonly", "loader_ro", is_onoff=True)
         cls.add_arg("loader.type", "loader_type")
diff --git a/virtinst/domain/os.py b/virtinst/domain/os.py
index 1df4b591..59fbc43e 100644
--- a/virtinst/domain/os.py
+++ b/virtinst/domain/os.py
@@ -67,6 +67,7 @@ class DomainOs(XMLBuilder):
     XML_NAME = "os"
     _XML_PROP_ORDER = ["arch", "os_type", "loader", "loader_ro", "loader_type",
                        "nvram", "nvram_template", "kernel", "initrd",
+                       "initdir", "inituser", "initgroup",
                        "kernel_args", "dtb", "bootdevs", "smbios_mode"]
 
     def _get_bootorder(self):
@@ -100,6 +101,9 @@ class DomainOs(XMLBuilder):
     kernel_args = XMLProperty("./cmdline")
 
     init = XMLProperty("./init")
+    initdir = XMLProperty("./initdir")
+    inituser = XMLProperty("./inituser")
+    initgroup = XMLProperty("./initgroup")
     loader = XMLProperty("./loader")
     loader_ro = XMLProperty("./loader/@readonly", is_yesno=True)
     loader_type = XMLProperty("./loader/@type")
-- 
2.21.0




More information about the virt-tools-list mailing list