[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[et-mgmt-tools] [patch] virtinst - ImageParser support disk checksum parsing, patch 2 of disk checksum feature



Adds support to parse disk signature values from ImageParser, updates image.rng schema as well.
diff -r 3e2e7db24cb5 doc/image.rng
--- a/doc/image.rng	Thu Oct 09 12:35:25 2008 -0400
+++ b/doc/image.rng	Thu Oct 09 16:27:28 2008 -0400
@@ -197,6 +197,15 @@
             </choice>
           </attribute>
         </optional>
+        <optional>
+          <element name="checksum">
+            <attribute name="type">
+              <value>sha1</value>
+              <value>sha256</value>
+            </attribute>
+            <text/>
+          </element>
+        </optional>
       </element>
     </oneOrMore>
   </define>
diff -r 3e2e7db24cb5 virtinst/ImageParser.py
--- a/virtinst/ImageParser.py	Thu Oct 09 12:35:25 2008 -0400
+++ b/virtinst/ImageParser.py	Thu Oct 09 16:27:28 2008 -0400
@@ -203,7 +203,8 @@
         self.file = None
         self.format = None
         self.size = None
-        self.use=None
+        self.use = None
+        self.csum = {}
         if not node is None:
             self.parseXML(node)
 
@@ -214,6 +215,10 @@
         self.size = xpathString(node, "@size")
         self.use = xpathString(node, "@use", Disk.USE_SYSTEM)
 
+        for d in node.xpathEval("checksum"):
+            csumtype = xpathString(d, "@type")
+            csumvalue = xpathString(d, "")
+            self.csum[csumtype] = csumvalue
         formats = [Disk.FORMAT_RAW, Disk.FORMAT_QCOW, Disk.FORMAT_QCOW2, Disk.FORMAT_VMDK, Disk.FORMAT_ISO]
         validate (formats.count(self.format) > 0,
                   _("The format for disk %s must be one of %s") %

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]