mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
guest: Drop self.autostart and self.replace
Require callers to pass autostart as an argument to start_install self.replace isn't even used for guest installs
This commit is contained in:
parent
9e05c56397
commit
8a6a491306
@ -561,7 +561,6 @@ def build_guest_instance(conn, options):
|
||||
guest.uuid = options.uuid
|
||||
if options.description:
|
||||
guest.description = options.description
|
||||
guest.autostart = options.autostart
|
||||
|
||||
cli.parse_option_strings(options, guest, None)
|
||||
|
||||
@ -646,9 +645,10 @@ def start_install(guest, options):
|
||||
start_time = time.time()
|
||||
|
||||
# Do first install phase
|
||||
domain = guest.start_install(
|
||||
meter=meter, doboot=not options.noreboot,
|
||||
transient=options.transient)
|
||||
domain = guest.start_install(meter=meter,
|
||||
doboot=not options.noreboot,
|
||||
transient=options.transient,
|
||||
autostart=options.autostart)
|
||||
cli.connect_console(guest, domain, conscb, wait_on_console)
|
||||
check_domain(guest, domain, conscb, options.transient,
|
||||
wait_on_install, wait_time, start_time)
|
||||
|
@ -269,7 +269,6 @@ class Cloner(object):
|
||||
|
||||
self._guest = Guest(self.conn, parsexml=self.original_xml)
|
||||
self._guest.id = None
|
||||
self._guest.replace = self.replace
|
||||
|
||||
# Pull clonable storage info from the original xml
|
||||
self._original_disks = self._get_original_disks_info()
|
||||
|
@ -122,9 +122,6 @@ class Guest(XMLBuilder):
|
||||
def __init__(self, *args, **kwargs):
|
||||
XMLBuilder.__init__(self, *args, **kwargs)
|
||||
|
||||
self.autostart = False
|
||||
self.replace = False
|
||||
|
||||
# Allow virt-manager to override the default graphics type
|
||||
self.default_graphics_type = CLIConfig.default_graphics
|
||||
|
||||
@ -152,7 +149,7 @@ class Guest(XMLBuilder):
|
||||
def _validate_name(self, val):
|
||||
if val == self.name:
|
||||
return
|
||||
self.validate_name(self.conn, val, check_collision=not self.replace)
|
||||
self.validate_name(self.conn, val, check_collision=False)
|
||||
name = XMLProperty("./name", validate_cb=_validate_name)
|
||||
|
||||
def _set_memory(self, val):
|
||||
@ -283,8 +280,6 @@ class Guest(XMLBuilder):
|
||||
#################################
|
||||
|
||||
def start_install(self, *args, **kwargs):
|
||||
self.installer.autostart = self.autostart
|
||||
self.installer.replace = self.replace
|
||||
return self.installer.start_install(self, *args, **kwargs)
|
||||
def get_created_disks(self):
|
||||
return self.installer.get_created_disks(self)
|
||||
|
@ -59,9 +59,6 @@ class Installer(object):
|
||||
self._tmpfiles = []
|
||||
self._tmpvols = []
|
||||
|
||||
self.autostart = False
|
||||
self.replace = False
|
||||
|
||||
|
||||
#########################
|
||||
# Properties properties #
|
||||
@ -349,9 +346,6 @@ class Installer(object):
|
||||
"""
|
||||
Set the autostart flag for domain if the user requested it
|
||||
"""
|
||||
if not self.autostart:
|
||||
return
|
||||
|
||||
try:
|
||||
domain.setAutostart(True)
|
||||
except libvirt.libvirtError as e:
|
||||
@ -368,10 +362,13 @@ class Installer(object):
|
||||
|
||||
def start_install(self, guest, meter=None,
|
||||
dry=False, return_xml=False,
|
||||
doboot=True, transient=False):
|
||||
doboot=True, transient=False, autostart=False):
|
||||
"""
|
||||
Begin the guest install (stage1).
|
||||
Begin the guest install. Will add install media to the guest config,
|
||||
launch it, then redefine the XML with the postinstall config.
|
||||
|
||||
:param return_xml: Don't create the guest, just return generated XML
|
||||
:param autostart: If True, mark the VM to autostart on host boot
|
||||
"""
|
||||
self._add_install_cdrom_device(guest)
|
||||
guest.set_install_defaults()
|
||||
@ -391,16 +388,13 @@ class Installer(object):
|
||||
if dry:
|
||||
return
|
||||
|
||||
# Remove existing VM if requested
|
||||
guest.check_vm_collision(self.conn, guest.name,
|
||||
do_remove=self.replace)
|
||||
|
||||
guest.check_vm_collision(self.conn, guest.name, False)
|
||||
domain = self._create_guest(
|
||||
guest, meter, install_xml, final_xml,
|
||||
doboot, transient)
|
||||
|
||||
# Set domain autostart flag if requested
|
||||
self._flag_autostart(domain)
|
||||
if autostart:
|
||||
self._flag_autostart(domain)
|
||||
return domain
|
||||
finally:
|
||||
self._cleanup(guest)
|
||||
|
Loading…
Reference in New Issue
Block a user