mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
devices: disk: Rename setup() to build_storage()
It's more explicit. Plus drop the supposedly generic setup() entry point, storage is handled specially everywhere so it's not a generic interface
This commit is contained in:
parent
ebd6091cc8
commit
bd35f4711c
2
virt-xml
2
virt-xml
@ -230,7 +230,7 @@ def setup_device(dev):
|
||||
|
||||
logging.debug("Doing setup for disk=%s", dev)
|
||||
|
||||
dev.setup(cli.get_meter())
|
||||
dev.build_storage(cli.get_meter())
|
||||
dev.virt_xml_setup = True
|
||||
|
||||
|
||||
|
@ -1055,15 +1055,17 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
######################
|
||||
|
||||
def _setup_device(self, asyncjob):
|
||||
if self._dev.DEVICE_TYPE != "disk":
|
||||
return
|
||||
|
||||
poolname = None
|
||||
if (self._dev.DEVICE_TYPE == "disk" and
|
||||
self._dev.wants_storage_creation() and
|
||||
if (self._dev.wants_storage_creation() and
|
||||
self._dev.get_parent_pool()):
|
||||
poolname = self._dev.get_parent_pool().name()
|
||||
|
||||
logging.debug("Running setup() for device=%s", self._dev)
|
||||
self._dev.setup(meter=asyncjob.get_meter())
|
||||
logging.debug("Device setup() complete")
|
||||
logging.debug("Running build_storage() for device=%s", self._dev)
|
||||
self._dev.build_storage(meter=asyncjob.get_meter())
|
||||
logging.debug("build_storage() complete")
|
||||
|
||||
if poolname:
|
||||
try:
|
||||
|
@ -475,7 +475,7 @@ class vmmDomain(vmmLibvirtObject):
|
||||
|
||||
new_nvram.set_vol_install(nvram_install)
|
||||
new_nvram.validate()
|
||||
new_nvram.setup()
|
||||
new_nvram.build_storage(None)
|
||||
|
||||
return new_nvram, old_nvram
|
||||
|
||||
|
@ -454,9 +454,9 @@ class Cloner(object):
|
||||
|
||||
if self.preserve:
|
||||
for dst_dev in self.clone_disks:
|
||||
dst_dev.setup(meter=meter)
|
||||
dst_dev.build_storage(meter)
|
||||
if self._nvram_disk:
|
||||
self._nvram_disk.setup(meter=meter)
|
||||
self._nvram_disk.build_storage(meter)
|
||||
except Exception as e:
|
||||
logging.debug("Duplicate failed: %s", str(e))
|
||||
if dom:
|
||||
|
@ -119,14 +119,3 @@ class Device(XMLBuilder):
|
||||
@property
|
||||
def DEVICE_TYPE(self):
|
||||
return self.XML_NAME
|
||||
|
||||
def setup(self, meter=None):
|
||||
"""
|
||||
Perform potentially hazardous device initialization, like
|
||||
storage creation or host device reset
|
||||
|
||||
:param meter: Optional progress meter to use
|
||||
"""
|
||||
# Will be overwritten by subclasses if necessary.
|
||||
ignore = meter
|
||||
return
|
||||
|
@ -910,7 +910,7 @@ class DeviceDisk(Device):
|
||||
|
||||
self._storage_backend.validate(self)
|
||||
|
||||
def setup(self, meter=None):
|
||||
def build_storage(self, meter):
|
||||
"""
|
||||
Build storage (if required)
|
||||
|
||||
|
@ -393,10 +393,9 @@ class Installer(object):
|
||||
self._cleanup(guest)
|
||||
self._prepare(guest, meter)
|
||||
|
||||
# Create devices if required (disk images, etc.)
|
||||
if not dry:
|
||||
for dev in guest.devices.get_all():
|
||||
dev.setup(meter)
|
||||
for dev in guest.devices.disk:
|
||||
dev.build_storage(meter)
|
||||
|
||||
install_xml, final_xml = self._build_xml(guest)
|
||||
if return_xml:
|
||||
|
@ -68,7 +68,7 @@ def _upload_file(conn, meter, destpool, src):
|
||||
disk.set_vol_install(vol_install)
|
||||
disk.validate()
|
||||
|
||||
disk.setup(meter=meter)
|
||||
disk.build_storage(meter)
|
||||
vol = disk.get_vol_object()
|
||||
if not vol:
|
||||
raise RuntimeError(_("Failed to lookup scratch media volume"))
|
||||
|
Loading…
Reference in New Issue
Block a user