(self, clone, template, metadata=False)
| 93 | return vol.storagePoolLookupByVolume() |
| 94 | |
| 95 | def clone_from_template(self, clone, template, metadata=False): |
| 96 | vol = self.get_volume_by_path(template) |
| 97 | stg = vol.storagePoolLookupByVolume() |
| 98 | storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type") |
| 99 | format = util.get_xml_path(vol.XMLDesc(0), "/volume/target/format/@type") |
| 100 | if storage_type == 'dir': |
| 101 | clone += '.img' |
| 102 | else: |
| 103 | metadata = False |
| 104 | xml = """ |
| 105 | <volume> |
| 106 | <name>%s</name> |
| 107 | <capacity>0</capacity> |
| 108 | <allocation>0</allocation> |
| 109 | <target> |
| 110 | <format type='%s'/> |
| 111 | </target> |
| 112 | </volume>""" % (clone, format) |
| 113 | stg.createXMLFrom(xml, vol, metadata) |
| 114 | clone_vol = stg.storageVolLookupByName(clone) |
| 115 | return clone_vol.path() |
| 116 | |
| 117 | def _defineXML(self, xml): |
| 118 | self.wvm.defineXML(xml) |
no test coverage detected