From 0f57dae8b2ba8e0dd52aac056c17081c0ae377a4 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 14 Apr 2013 16:26:51 -0400 Subject: [PATCH] virtinst: Remove not-very-useful post_install_check It doesn't work in a variety of cases and it's not very useful to begin with. --- tests/xmlconfig.py | 17 -------------- virt-install | 4 ---- virtinst/Guest.py | 6 ----- virtinst/ImageInstaller.py | 3 --- virtinst/ImportInstaller.py | 3 --- virtinst/Installer.py | 45 ------------------------------------- virtinst/LiveCDInstaller.py | 3 --- 7 files changed, 81 deletions(-) diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py index 088b3b67..b200dfed 100644 --- a/tests/xmlconfig.py +++ b/tests/xmlconfig.py @@ -136,23 +136,6 @@ class TestXMLConfig(unittest.TestCase): g.add_device(utils.get_filedisk("/tmp/somerandomfilename.img")) self._compare(g, "boot-paravirt-disk-file", False) - # Just cram some post_install_checks in here - try: - g.post_install_check() - raise AssertionError("Expected OSError, none caught.") - except OSError: - pass - - disk = g.get_devices("disk")[0] - disk.path = "virt-install" - self.assertEquals(g.post_install_check(), False) - - disk.driver_type = "raw" - self.assertEquals(g.post_install_check(), False) - - disk.driver_type = "foobar" - self.assertEquals(g.post_install_check(), True) - def testBootParavirtDiskFileBlktapCapable(self): oldblktap = virtinst.util.is_blktap_capable try: diff --git a/virt-install b/virt-install index c8371e7f..8e817f79 100755 --- a/virt-install +++ b/virt-install @@ -669,10 +669,6 @@ def start_install(guest, continue_inst, options): dom = check_domain(guest, dom, conscb, wait_on_install, wait_time, start_time) - # This should be valid even before doing continue install - if not guest.post_install_check(): - cli.install_fail(guest) - if continue_inst: dom = guest.continue_install(conscb, meter, wait=wait_on_console) dom = check_domain(guest, dom, conscb, diff --git a/virtinst/Guest.py b/virtinst/Guest.py index 96c1866f..67024445 100644 --- a/virtinst/Guest.py +++ b/virtinst/Guest.py @@ -983,12 +983,6 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain): return xml - def post_install_check(self): - """ - Back compat mapping to installer post_install_check - """ - return self.installer.post_install_check(self) - def get_continue_inst(self): """ Return True if this guest requires a call to 'continue_install', diff --git a/virtinst/ImageInstaller.py b/virtinst/ImageInstaller.py index c6cb74fe..d9177c31 100644 --- a/virtinst/ImageInstaller.py +++ b/virtinst/ImageInstaller.py @@ -102,9 +102,6 @@ class ImageInstaller(Installer.Installer): self.bootconfig.initrd = self.boot_caps.initrd self.bootconfig.kernel_args = self.boot_caps.cmdline - def post_install_check(self, guest): - return True - def has_install_phase(self): return False diff --git a/virtinst/ImportInstaller.py b/virtinst/ImportInstaller.py index 4073fafd..26eee05d 100644 --- a/virtinst/ImportInstaller.py +++ b/virtinst/ImportInstaller.py @@ -35,9 +35,6 @@ class ImportInstaller(Installer.Installer): def prepare(self, guest, meter): pass - def post_install_check(self, guest): - return True - def has_install_phase(self): return False diff --git a/virtinst/Installer.py b/virtinst/Installer.py index 417392b9..92a4e461 100644 --- a/virtinst/Installer.py +++ b/virtinst/Installer.py @@ -20,8 +20,6 @@ # MA 02110-1301 USA. import os -import errno -import struct import platform import logging import copy @@ -31,7 +29,6 @@ import virtinst from virtinst import XMLBuilderDomain from virtinst.XMLBuilderDomain import _xml_property from virtinst import CapabilitiesParser -from virtinst.VirtualDisk import VirtualDisk from virtinst.Boot import Boot XEN_SCRATCH = "/var/lib/xen" @@ -411,48 +408,6 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain): """ raise NotImplementedError("Must be implemented in subclass") - def post_install_check(self, guest): - """ - Attempt to verify that installing to disk was successful. - @param guest: guest instance that was installed - @type L{Guest} - """ - - if guest.is_remote(): - # XXX: Use block peek for this? - return True - - disks = guest.get_devices("disk") - if not disks: - return True - - disk = disks[0] - if disk.device != VirtualDisk.DEVICE_DISK: - return True - if util.is_vdisk(disk.path): - return True - - if (disk.driver_type and - disk.driver_type not in [disk.DRIVER_TAP_RAW, - disk.DRIVER_QEMU_RAW]): - # Might be a non-raw format - return True - - # Check for the 0xaa55 signature at the end of the MBR - try: - fd = os.open(disk.path, os.O_RDONLY) - except OSError, (err, msg): - logging.debug("Failed to open guest disk: %s", msg) - if err == errno.EACCES and os.geteuid() != 0: - return True # non root might not have access to block devices - else: - raise - - buf = os.read(fd, 512) - os.close(fd) - return (len(buf) == 512 and - struct.unpack("H", buf[0x1fe: 0x200]) == (0xaa55,)) - def detect_distro(self): """ Attempt to detect the distro for the Installer's 'location'. If diff --git a/virtinst/LiveCDInstaller.py b/virtinst/LiveCDInstaller.py index 195e86d0..72f1b69c 100644 --- a/virtinst/LiveCDInstaller.py +++ b/virtinst/LiveCDInstaller.py @@ -68,9 +68,6 @@ class LiveCDInstaller(Installer.Installer): self.install_devices.append(disk) - def post_install_check(self, guest): - return True - def has_install_phase(self): return False