(self, storage, name, size, format='qcow2', metadata=False)
| 41 | return util.get_xml_path(self.get_cap_xml(), "/capabilities/host/cpu/arch") |
| 42 | |
| 43 | def create_volume(self, storage, name, size, format='qcow2', metadata=False): |
| 44 | size = int(size) * 1073741824 |
| 45 | stg = self.get_storage(storage) |
| 46 | storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type") |
| 47 | if storage_type == 'dir': |
| 48 | name += '.img' |
| 49 | alloc = 0 |
| 50 | else: |
| 51 | alloc = size |
| 52 | metadata = False |
| 53 | xml = """ |
| 54 | <volume> |
| 55 | <name>%s</name> |
| 56 | <capacity>%s</capacity> |
| 57 | <allocation>%s</allocation> |
| 58 | <target> |
| 59 | <format type='%s'/> |
| 60 | </target> |
| 61 | </volume>""" % (name, size, alloc, format) |
| 62 | stg.createXML(xml, metadata) |
| 63 | try: |
| 64 | stg.refresh(0) |
| 65 | except: |
| 66 | pass |
| 67 | vol = stg.storageVolLookupByName(name) |
| 68 | return vol.path() |
| 69 | |
| 70 | def get_volume_type(self, path): |
| 71 | vol = self.get_volume_by_path(path) |
no test coverage detected