diff --git a/virt-xml b/virt-xml index c4a3d36a8..9bdde95dc 100755 --- a/virt-xml +++ b/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 diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py index 434509dff..2981e4652 100644 --- a/virtManager/addhardware.py +++ b/virtManager/addhardware.py @@ -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: diff --git a/virtManager/domain.py b/virtManager/domain.py index 1d04adff0..cad95fe13 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -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 diff --git a/virtinst/cloner.py b/virtinst/cloner.py index c8c85db69..ba89a26f3 100644 --- a/virtinst/cloner.py +++ b/virtinst/cloner.py @@ -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: diff --git a/virtinst/devices/device.py b/virtinst/devices/device.py index 32fab4551..7763feeee 100644 --- a/virtinst/devices/device.py +++ b/virtinst/devices/device.py @@ -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 diff --git a/virtinst/devices/disk.py b/virtinst/devices/disk.py index 3591bea0b..186cf083c 100644 --- a/virtinst/devices/disk.py +++ b/virtinst/devices/disk.py @@ -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) diff --git a/virtinst/installer.py b/virtinst/installer.py index 402ccf8dd..d9588ba7c 100644 --- a/virtinst/installer.py +++ b/virtinst/installer.py @@ -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: diff --git a/virtinst/kernelupload.py b/virtinst/kernelupload.py index e6e500be7..3524282b5 100644 --- a/virtinst/kernelupload.py +++ b/virtinst/kernelupload.py @@ -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"))