[virt-tools-list] [virt-manager PATCH 4/5] Fix VirtualDisk formatting

Martin Kletzander mkletzan at redhat.com
Tue Jun 18 14:12:38 UTC 2013


Add EOLs after iotune elements and add address generation when the
address is set.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 virtinst/VirtualDisk.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/virtinst/VirtualDisk.py b/virtinst/VirtualDisk.py
index 7d9536b..77f3c20 100644
--- a/virtinst/VirtualDisk.py
+++ b/virtinst/VirtualDisk.py
@@ -1,7 +1,7 @@
 #
 # Classes for building disk device xml
 #
-# Copyright 2006-2008, 2012  Red Hat, Inc.
+# Copyright 2006-2008, 2012-2013  Red Hat, Inc.
 # Jeremy Katz <katzj at redhat.com>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -1565,21 +1565,24 @@ class VirtualDisk(VirtualDevice):
         if (self.iotune_rbs or self.iotune_ris or
             self.iotune_tbs or self.iotune_tis or
             self.iotune_wbs or self.iotune_wis):
-            ret += "      <iotune>"
+            ret += "      <iotune>\n"
             if self.iotune_rbs:
-                ret += "        <read_bytes_sec>%s</read_bytes_sec>" % (self.iotune_rbs)
+                ret += "        <read_bytes_sec>%s</read_bytes_sec>\n" % (self.iotune_rbs)
             if self.iotune_ris:
-                ret += "        <read_iops_sec>%s</read_iops_sec>" % (self.iotune_ris)
+                ret += "        <read_iops_sec>%s</read_iops_sec>\n" % (self.iotune_ris)
             if self.iotune_tbs:
-                ret += "        <total_bytes_sec>%s</total_bytes_sec>" % (self.iotune_tbs)
+                ret += "        <total_bytes_sec>%s</total_bytes_sec>\n" % (self.iotune_tbs)
             if self.iotune_tis:
-                ret += "        <total_iops_sec>%s</total_iops_sec>" % (self.iotune_tis)
+                ret += "        <total_iops_sec>%s</total_iops_sec>\n" % (self.iotune_tis)
             if self.iotune_wbs:
-                ret += "        <write_bytes_sec>%s</write_bytes_sec>" % (self.iotune_wbs)
+                ret += "        <write_bytes_sec>%s</write_bytes_sec>\n" % (self.iotune_wbs)
             if self.iotune_wis:
-                ret += "        <write_iops_sec>%s</write_iops_sec>" % (self.iotune_wis)
-            ret += "      </iotune>"
+                ret += "        <write_iops_sec>%s</write_iops_sec>\n" % (self.iotune_wis)
+            ret += "      </iotune>\n"

+        addr = self.indent(self.address.get_xml_config(), 6)
+        if addr:
+            ret += addr
         ret += "    </disk>"
         return ret

-- 
1.8.2.1




More information about the virt-tools-list mailing list