MCPcopy Index your code
hub / github.com/retspen/webvirtcloud / create_volume

Method create_volume

vrtManager/storage.py:203–221  ·  view source on GitHub ↗
(self, name, size, vol_fmt='qcow2', metadata=False)

Source from the content-addressed store, hash-verified

201 return vol_list
202
203 def create_volume(self, name, size, vol_fmt='qcow2', metadata=False):
204 size = int(size) * 1073741824
205 storage_type = self.get_type()
206 alloc = size
207 if vol_fmt == 'unknown':
208 vol_fmt = 'raw'
209 if storage_type == 'dir':
210 name += '.img'
211 alloc = 0
212 xml = """
213 <volume>
214 <name>%s</name>
215 <capacity>%s</capacity>
216 <allocation>%s</allocation>
217 <target>
218 <format type='%s'/>
219 </target>
220 </volume>""" % (name, size, alloc, vol_fmt)
221 self._createXML(xml, metadata)
222
223 def clone_volume(self, name, clone, vol_fmt=None, metadata=False):
224 storage_type = self.get_type()

Callers

nothing calls this directly

Calls 2

get_typeMethod · 0.95
_createXMLMethod · 0.95

Tested by

no test coverage detected