mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 07:03:02 -06:00
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.
This commit is contained in:
parent
ee7168e6f9
commit
0f57dae8b2
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user