[virt-tools-list] [PATCH virt-manager] cli: Add --disk geometry attribute options

Anya Harter aharter at redhat.com
Thu Jun 7 15:29:43 UTC 2018


Attribute options are:
    - geometry.cyls=W
    - geometry.heads=X
    - geometry.secs=Y
    - geometry.trans=Z

This maps to disk XML like:

    <disk>
      <geometry cyls='W' heads='X' secs='Y' trans='Z'/>
    </disk>

Signed-off-by: Anya Harter <aharter at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-many-devices.xml | 1 +
 tests/clitest.py                                         | 2 +-
 virtinst/cli.py                                          | 5 +++++
 virtinst/devices/disk.py                                 | 5 +++++
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index 0028bc08..25f76016 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -51,6 +51,7 @@
         <write_iops_sec>6</write_iops_sec>
         <total_iops_sec>20</total_iops_sec>
       </iotune>
+      <geometry cyls="16383" heads="16" secs="63" trans="lba"/>
       <readonly/>
     </disk>
     <disk type="file" device="disk">
diff --git a/tests/clitest.py b/tests/clitest.py
index 466e96f5..c84156f9 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -462,7 +462,7 @@ c.add_compare(""" \
 \
 --disk %(EXISTUPPER)s,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149,boot_order=2 \
 --disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace,discard=unmap,detect_zeroes=yes \
---disk device=cdrom,bus=sata,read_bytes_sec=1,read_iops_sec=2,total_bytes_sec=10,total_iops_sec=20,write_bytes_sec=5,write_iops_sec=6,driver.copy_on_read=on \
+--disk device=cdrom,bus=sata,read_bytes_sec=1,read_iops_sec=2,total_bytes_sec=10,total_iops_sec=20,write_bytes_sec=5,write_iops_sec=6,driver.copy_on_read=on,geometry.cyls=16383,geometry.heads=16,geometry.secs=63,geometry.trans=lba \
 --disk size=1 \
 --disk %(BLOCKVOL)s \
 --disk /dev/default-pool/iso-vol,seclabel.model=dac,seclabel1.model=selinux,seclabel1.relabel=no,seclabel0.label=foo,bar,baz \
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 28e414da..0bee94a9 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2145,6 +2145,11 @@ ParserDisk.add_arg("relabel", "seclabel[0-9]*.relabel", is_onoff=True,
 ParserDisk.add_arg("label", "seclabel[0-9]*.label", can_comma=True,
                    find_inst_cb=ParserDisk.seclabel_find_inst_cb)
 
+ParserDisk.add_arg("geometry_cyls", "geometry.cyls")
+ParserDisk.add_arg("geometry_heads", "geometry.heads")
+ParserDisk.add_arg("geometry_secs", "geometry.secs")
+ParserDisk.add_arg("geometry_trans", "geometry.trans")
+
 
 #####################
 # --network parsing #
diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py
index f69e8739..4e5afce4 100644
--- a/virtinst/devices/disk.py
+++ b/virtinst/devices/disk.py
@@ -775,6 +775,11 @@ class DeviceDisk(Device):
 
     seclabels = XMLChildProperty(_DiskSeclabel, relative_xpath="./source")
 
+    geometry_cyls = XMLProperty("./geometry/@cyls", is_int=True)
+    geometry_heads = XMLProperty("./geometry/@heads", is_int=True)
+    geometry_secs = XMLProperty("./geometry/@secs", is_int=True)
+    geometry_trans = XMLProperty("./geometry/@trans")
+
 
     #################################
     # Validation assistance methods #
-- 
2.17.1




More information about the virt-tools-list mailing list