2006-08-09 23:40:34 +08:00
|
|
|
#
|
2014-01-21 00:09:13 +08:00
|
|
|
# Copyright (C) 2008, 2013, 2014 Red Hat, Inc.
|
2009-03-10 04:16:45 +08:00
|
|
|
# Copyright (C) 2008 Cole Robinson <crobinso@redhat.com>
|
2006-08-09 23:40:34 +08:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-11-21 00:12:20 +08:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301 USA.
|
2006-08-09 23:40:34 +08:00
|
|
|
#
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
import logging
|
2013-07-07 08:03:42 +08:00
|
|
|
import threading
|
|
|
|
import time
|
2006-08-09 23:40:34 +08:00
|
|
|
|
2013-04-12 05:16:33 +08:00
|
|
|
# pylint: disable=E0611
|
2012-05-14 21:24:56 +08:00
|
|
|
from gi.repository import GObject
|
|
|
|
from gi.repository import Gtk
|
|
|
|
from gi.repository import Gdk
|
2013-04-12 05:16:33 +08:00
|
|
|
# pylint: enable=E0611
|
2011-04-29 04:17:44 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
import virtinst
|
2013-08-09 21:23:01 +08:00
|
|
|
from virtinst import util
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-08-09 21:23:01 +08:00
|
|
|
from virtManager import uihelpers
|
2009-12-11 09:04:26 +08:00
|
|
|
from virtManager.mediadev import MEDIA_CDROM
|
2010-12-09 06:26:19 +08:00
|
|
|
from virtManager.baseclass import vmmGObjectUI
|
2009-03-10 04:16:45 +08:00
|
|
|
from virtManager.asyncjob import vmmAsyncJob
|
2009-03-10 04:19:39 +08:00
|
|
|
from virtManager.storagebrowse import vmmStorageBrowser
|
2010-02-08 01:18:28 +08:00
|
|
|
from virtManager.details import vmmDetails
|
|
|
|
from virtManager.domain import vmmDomainVirtinst
|
2006-08-17 04:00:28 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Number of seconds to wait for media detection
|
|
|
|
DETECT_TIMEOUT = 20
|
2006-08-10 06:53:30 +08:00
|
|
|
|
2011-04-28 22:39:12 +08:00
|
|
|
DEFAULT_MEM = 1024
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
PAGE_NAME = 0
|
|
|
|
PAGE_INSTALL = 1
|
|
|
|
PAGE_MEM = 2
|
|
|
|
PAGE_STORAGE = 3
|
|
|
|
PAGE_FINISH = 4
|
2008-02-24 04:26:26 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
INSTALL_PAGE_ISO = 0
|
|
|
|
INSTALL_PAGE_URL = 1
|
|
|
|
INSTALL_PAGE_PXE = 2
|
2010-03-23 06:15:18 +08:00
|
|
|
INSTALL_PAGE_IMPORT = 3
|
2011-06-08 05:42:50 +08:00
|
|
|
INSTALL_PAGE_CONTAINER_APP = 4
|
|
|
|
INSTALL_PAGE_CONTAINER_OS = 5
|
2009-11-21 00:39:22 +08:00
|
|
|
|
2014-01-21 00:09:13 +08:00
|
|
|
STABLE_OS_SUPPORT = [
|
2011-07-26 07:13:38 +08:00
|
|
|
"rhel3", "rhel4", "rhel5.4", "rhel6",
|
|
|
|
"win2k3", "winxp", "win2k8", "vista", "win7",
|
|
|
|
]
|
|
|
|
|
2012-02-03 00:32:29 +08:00
|
|
|
|
2013-10-03 01:19:40 +08:00
|
|
|
def pretty_arch(_a):
|
|
|
|
if _a == "armv7l":
|
|
|
|
return "arm"
|
|
|
|
return _a
|
|
|
|
|
|
|
|
|
2010-12-09 06:26:19 +08:00
|
|
|
class vmmCreate(vmmGObjectUI):
|
2012-05-14 21:24:56 +08:00
|
|
|
__gsignals__ = {
|
2013-09-23 03:13:41 +08:00
|
|
|
"action-show-domain": (GObject.SignalFlags.RUN_FIRST, None, [str, str]),
|
2012-05-14 21:24:56 +08:00
|
|
|
}
|
|
|
|
|
2010-12-09 06:26:19 +08:00
|
|
|
def __init__(self, engine):
|
2013-09-23 04:10:16 +08:00
|
|
|
vmmGObjectUI.__init__(self, "create.ui", "vmm-create")
|
2010-12-01 03:33:21 +08:00
|
|
|
self.engine = engine
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
self.conn = None
|
|
|
|
self.caps = None
|
|
|
|
self.capsguest = None
|
|
|
|
self.capsdomain = None
|
2010-12-08 05:48:13 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
self.guest = None
|
2010-12-08 05:48:13 +08:00
|
|
|
self.disk = None
|
|
|
|
self.nic = None
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
self.storage_browser = None
|
2009-12-01 00:56:41 +08:00
|
|
|
self.conn_signals = []
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Distro detection state variables
|
2013-08-11 06:48:43 +08:00
|
|
|
self.detectedDistro = -1
|
2012-02-10 19:58:45 +08:00
|
|
|
self.detecting = False
|
2010-12-04 01:55:56 +08:00
|
|
|
self.mediaDetected = False
|
2011-07-26 06:53:09 +08:00
|
|
|
self.show_all_os = False
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2009-07-07 04:49:47 +08:00
|
|
|
# 'Guest' class from the previous failed install
|
|
|
|
self.failed_guest = None
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-03-16 04:33:55 +08:00
|
|
|
# Whether there was an error at dialog startup
|
|
|
|
self.have_startup_error = False
|
|
|
|
|
2010-02-08 01:18:28 +08:00
|
|
|
# 'Configure before install' window
|
|
|
|
self.config_window = None
|
2011-07-19 09:31:06 +08:00
|
|
|
self.config_window_signals = []
|
2010-02-08 01:18:28 +08:00
|
|
|
|
2013-02-17 02:31:46 +08:00
|
|
|
self.builder.connect_signals({
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_vmm_newcreate_delete_event" : self.close,
|
|
|
|
|
|
|
|
"on_create_cancel_clicked": self.close,
|
2006-08-10 06:53:30 +08:00
|
|
|
"on_create_back_clicked" : self.back,
|
|
|
|
"on_create_forward_clicked" : self.forward,
|
|
|
|
"on_create_finish_clicked" : self.finish,
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_create_pages_switch_page": self.page_changed,
|
2006-10-26 03:02:57 +08:00
|
|
|
|
2009-12-15 05:26:46 +08:00
|
|
|
"on_create_vm_name_activate": self.forward,
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_create_conn_changed": self.conn_changed,
|
2011-06-22 01:04:46 +08:00
|
|
|
"on_method_changed": self.method_changed,
|
2013-10-02 23:56:51 +08:00
|
|
|
"on_config_machine_changed": self.machine_changed,
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
"on_install_url_box_changed": self.url_box_changed,
|
2009-11-16 05:36:37 +08:00
|
|
|
"on_install_local_cdrom_toggled": self.toggle_local_cdrom,
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_install_local_cdrom_combo_changed": self.detect_media_os,
|
2009-05-11 23:00:03 +08:00
|
|
|
"on_install_local_box_changed": self.detect_media_os,
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_install_local_browse_clicked": self.browse_iso,
|
2010-03-23 06:15:18 +08:00
|
|
|
"on_install_import_browse_clicked": self.browse_import,
|
2011-06-08 05:42:50 +08:00
|
|
|
"on_install_app_browse_clicked": self.browse_app,
|
2011-06-21 23:04:22 +08:00
|
|
|
"on_install_oscontainer_browse_clicked": self.browse_oscontainer,
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_install_detect_os_toggled": self.toggle_detect_os,
|
|
|
|
"on_install_os_type_changed": self.change_os_type,
|
2011-07-26 06:53:09 +08:00
|
|
|
"on_install_os_version_changed": self.change_os_version,
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_install_local_iso_toggled": self.toggle_local_iso,
|
|
|
|
"on_install_detect_os_box_show": self.detect_visibility_changed,
|
|
|
|
"on_install_detect_os_box_hide": self.detect_visibility_changed,
|
2007-06-23 01:32:13 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
"on_config_kernel_browse_clicked": self.browse_kernel,
|
|
|
|
"on_config_initrd_browse_clicked": self.browse_initrd,
|
|
|
|
"on_config_dtb_browse_clicked": self.browse_dtb,
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_enable_storage_toggled": self.toggle_enable_storage,
|
|
|
|
"on_config_storage_browse_clicked": self.browse_storage,
|
|
|
|
"on_config_storage_select_toggled": self.toggle_storage_select,
|
|
|
|
|
2010-12-05 01:28:44 +08:00
|
|
|
"on_config_netdev_changed": self.netdev_changed,
|
2009-03-10 04:16:45 +08:00
|
|
|
"on_config_set_macaddr_toggled": self.toggle_macaddr,
|
|
|
|
|
|
|
|
"on_config_hv_changed": self.hv_changed,
|
|
|
|
"on_config_arch_changed": self.arch_changed,
|
|
|
|
})
|
2011-04-18 23:25:28 +08:00
|
|
|
self.bind_escape_key_close()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
self.set_initial_state()
|
|
|
|
|
2010-02-08 01:18:28 +08:00
|
|
|
def is_visible(self):
|
2012-05-14 21:24:56 +08:00
|
|
|
return self.topwin.get_visible()
|
2010-02-08 01:18:28 +08:00
|
|
|
|
2011-04-14 20:47:42 +08:00
|
|
|
def show(self, parent, uri=None):
|
2012-02-01 07:16:54 +08:00
|
|
|
logging.debug("Showing new vm wizard")
|
2011-04-14 20:47:42 +08:00
|
|
|
|
2012-02-14 05:19:34 +08:00
|
|
|
if not self.is_visible():
|
|
|
|
self.reset_state(uri)
|
|
|
|
self.topwin.set_transient_for(parent)
|
|
|
|
|
2006-09-13 05:49:29 +08:00
|
|
|
self.topwin.present()
|
2006-08-09 23:40:34 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def close(self, ignore1=None, ignore2=None):
|
2012-02-01 07:16:54 +08:00
|
|
|
logging.debug("Closing new vm wizard")
|
2009-03-10 04:16:45 +08:00
|
|
|
self.topwin.hide()
|
2009-09-22 04:09:51 +08:00
|
|
|
|
2010-02-08 01:18:28 +08:00
|
|
|
if self.config_window:
|
|
|
|
self.config_window.close()
|
2011-04-13 21:27:02 +08:00
|
|
|
if self.storage_browser:
|
|
|
|
self.storage_browser.close()
|
2010-02-08 01:18:28 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
return 1
|
|
|
|
|
2011-07-24 09:16:54 +08:00
|
|
|
def _cleanup(self):
|
2011-04-13 21:27:02 +08:00
|
|
|
self.remove_conn()
|
|
|
|
|
|
|
|
self.conn = None
|
|
|
|
self.caps = None
|
|
|
|
self.capsguest = None
|
|
|
|
self.capsdomain = None
|
|
|
|
|
|
|
|
self.guest = None
|
|
|
|
self.disk = None
|
|
|
|
self.nic = None
|
|
|
|
|
2011-07-24 09:16:54 +08:00
|
|
|
if self.storage_browser:
|
|
|
|
self.storage_browser.cleanup()
|
|
|
|
self.storage_browser = None
|
2011-04-13 21:27:02 +08:00
|
|
|
|
|
|
|
def remove_conn(self):
|
|
|
|
if not self.conn:
|
|
|
|
return
|
|
|
|
|
|
|
|
for signal in self.conn_signals:
|
|
|
|
self.conn.disconnect(signal)
|
|
|
|
self.conn_signals = []
|
|
|
|
self.conn = None
|
|
|
|
|
2010-02-13 02:37:04 +08:00
|
|
|
def set_conn(self, newconn, force_validate=False):
|
|
|
|
if self.conn == newconn and not force_validate:
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
|
|
|
|
2011-04-13 21:27:02 +08:00
|
|
|
self.remove_conn()
|
2009-03-10 04:16:45 +08:00
|
|
|
self.conn = newconn
|
|
|
|
if self.conn:
|
|
|
|
self.set_conn_state()
|
|
|
|
|
|
|
|
|
|
|
|
# State init methods
|
2012-02-09 22:04:09 +08:00
|
|
|
def startup_error(self, error, hideinstall=True):
|
2011-03-16 04:33:55 +08:00
|
|
|
self.have_startup_error = True
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("startup-error-box").show()
|
|
|
|
self.widget("create-forward").set_sensitive(False)
|
2012-02-09 22:04:09 +08:00
|
|
|
if hideinstall:
|
|
|
|
self.widget("install-box").hide()
|
2013-10-05 22:31:02 +08:00
|
|
|
self.widget("arch-expander").hide()
|
2009-09-30 02:00:50 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("startup-error").set_text("Error: %s" % error)
|
2009-03-10 04:16:45 +08:00
|
|
|
return False
|
|
|
|
|
2010-02-11 09:26:40 +08:00
|
|
|
def startup_warning(self, error):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("startup-error-box").show()
|
|
|
|
self.widget("startup-error").set_text("Warning: %s" % error)
|
2010-02-11 09:26:40 +08:00
|
|
|
|
2006-08-09 23:40:34 +08:00
|
|
|
def set_initial_state(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-pages").set_show_tabs(False)
|
|
|
|
self.widget("install-method-pages").set_show_tabs(False)
|
2006-08-09 23:40:34 +08:00
|
|
|
|
2012-05-14 21:24:56 +08:00
|
|
|
blue = Gdk.Color.parse("#0072A8")[1]
|
2013-09-27 22:26:43 +08:00
|
|
|
self.widget("header").modify_bg(Gtk.StateType.NORMAL, blue)
|
2009-03-10 04:58:55 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Connection list
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-conn-label").set_text("")
|
|
|
|
self.widget("startup-error").set_text("")
|
|
|
|
conn_list = self.widget("create-conn")
|
2012-05-14 21:24:56 +08:00
|
|
|
conn_model = Gtk.ListStore(str, str)
|
2009-03-10 04:16:45 +08:00
|
|
|
conn_list.set_model(conn_model)
|
2012-05-14 21:24:56 +08:00
|
|
|
text = Gtk.CellRendererText()
|
2009-03-10 04:16:45 +08:00
|
|
|
conn_list.pack_start(text, True)
|
|
|
|
conn_list.add_attribute(text, 'text', 1)
|
|
|
|
|
2009-05-11 23:00:03 +08:00
|
|
|
# ISO media list
|
2011-07-15 01:13:13 +08:00
|
|
|
iso_list = self.widget("install-local-box")
|
2012-05-14 21:24:56 +08:00
|
|
|
iso_model = Gtk.ListStore(str)
|
2009-05-11 23:00:03 +08:00
|
|
|
iso_list.set_model(iso_model)
|
2012-05-14 21:24:56 +08:00
|
|
|
iso_list.set_entry_text_column(0)
|
|
|
|
self.widget("install-local-box").get_child().connect("activate",
|
2010-12-04 01:55:56 +08:00
|
|
|
self.detect_media_os)
|
2009-05-11 23:00:03 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Lists for the install urls
|
2011-07-15 01:13:13 +08:00
|
|
|
media_url_list = self.widget("install-url-box")
|
2012-05-14 21:24:56 +08:00
|
|
|
media_url_model = Gtk.ListStore(str)
|
2006-10-11 21:07:45 +08:00
|
|
|
media_url_list.set_model(media_url_model)
|
2012-05-14 21:24:56 +08:00
|
|
|
media_url_list.set_entry_text_column(0)
|
|
|
|
self.widget("install-url-box").get_child().connect("activate",
|
2010-12-04 01:55:56 +08:00
|
|
|
self.detect_media_os)
|
2006-10-11 21:07:45 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
ks_url_list = self.widget("install-ks-box")
|
2012-05-14 21:24:56 +08:00
|
|
|
ks_url_model = Gtk.ListStore(str)
|
2006-10-11 21:07:45 +08:00
|
|
|
ks_url_list.set_model(ks_url_model)
|
2012-05-14 21:24:56 +08:00
|
|
|
ks_url_list.set_entry_text_column(0)
|
2006-10-11 21:07:45 +08:00
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
def sep_func(model, it, combo):
|
|
|
|
ignore = combo
|
|
|
|
return model[it][2]
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Lists for distro type + variant
|
2011-07-26 06:53:09 +08:00
|
|
|
# [os value, os label, is seperator, is 'show all'
|
2011-07-15 01:13:13 +08:00
|
|
|
os_type_list = self.widget("install-os-type")
|
2012-05-14 21:24:56 +08:00
|
|
|
os_type_model = Gtk.ListStore(str, str, bool, bool)
|
2007-02-20 00:52:37 +08:00
|
|
|
os_type_list.set_model(os_type_model)
|
2012-05-14 21:24:56 +08:00
|
|
|
text = Gtk.CellRendererText()
|
2007-02-20 00:52:37 +08:00
|
|
|
os_type_list.pack_start(text, True)
|
2007-04-16 01:41:12 +08:00
|
|
|
os_type_list.add_attribute(text, 'text', 1)
|
2011-07-26 06:53:09 +08:00
|
|
|
os_type_list.set_row_separator_func(sep_func, os_type_list)
|
2007-02-20 00:52:37 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
os_variant_list = self.widget("install-os-version")
|
2012-05-14 21:24:56 +08:00
|
|
|
os_variant_model = Gtk.ListStore(str, str, bool, bool)
|
2007-02-20 00:52:37 +08:00
|
|
|
os_variant_list.set_model(os_variant_model)
|
2012-05-14 21:24:56 +08:00
|
|
|
text = Gtk.CellRendererText()
|
2007-02-20 00:52:37 +08:00
|
|
|
os_variant_list.pack_start(text, True)
|
2007-04-16 01:41:12 +08:00
|
|
|
os_variant_list.add_attribute(text, 'text', 1)
|
2011-07-26 06:53:09 +08:00
|
|
|
os_variant_list.set_row_separator_func(sep_func, os_variant_list)
|
|
|
|
|
2007-02-20 00:52:37 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Physical CD-ROM model
|
2011-07-15 01:13:13 +08:00
|
|
|
cd_list = self.widget("install-local-cdrom-combo")
|
2009-12-11 09:04:26 +08:00
|
|
|
uihelpers.init_mediadev_combo(cd_list)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Networking
|
|
|
|
# [ interface type, device name, label, sensitive ]
|
2011-07-15 01:13:13 +08:00
|
|
|
net_list = self.widget("config-netdev")
|
|
|
|
bridge_box = self.widget("config-netdev-bridge-box")
|
2010-03-21 06:35:47 +08:00
|
|
|
uihelpers.init_network_list(net_list, bridge_box)
|
2006-08-09 23:40:34 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Archtecture
|
2013-10-03 01:10:11 +08:00
|
|
|
# [value, label]
|
|
|
|
archModel = Gtk.ListStore(str, str)
|
2011-07-15 01:13:13 +08:00
|
|
|
archList = self.widget("config-arch")
|
2012-05-14 21:24:56 +08:00
|
|
|
text = Gtk.CellRendererText()
|
2009-03-10 04:16:45 +08:00
|
|
|
archList.pack_start(text, True)
|
2013-10-03 01:10:11 +08:00
|
|
|
archList.add_attribute(text, 'text', 1)
|
2008-03-10 06:18:33 +08:00
|
|
|
archList.set_model(archModel)
|
2013-10-03 01:10:11 +08:00
|
|
|
archList.set_row_separator_func(
|
|
|
|
lambda m, i, ignore: m[i][0] is None, None)
|
2007-02-20 12:11:21 +08:00
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
hyperModel = Gtk.ListStore(str, str)
|
2011-07-15 01:13:13 +08:00
|
|
|
hyperList = self.widget("config-hv")
|
2012-05-14 21:24:56 +08:00
|
|
|
text = Gtk.CellRendererText()
|
2009-03-10 04:16:45 +08:00
|
|
|
hyperList.pack_start(text, True)
|
|
|
|
hyperList.add_attribute(text, 'text', 0)
|
2008-03-10 06:18:33 +08:00
|
|
|
hyperList.set_model(hyperModel)
|
2007-02-20 12:11:21 +08:00
|
|
|
|
2013-10-02 05:40:44 +08:00
|
|
|
model = Gtk.ListStore(str)
|
|
|
|
lst = self.widget("config-machine")
|
|
|
|
text = Gtk.CellRendererText()
|
|
|
|
lst.pack_start(text, True)
|
|
|
|
lst.add_attribute(text, 'text', 0)
|
|
|
|
lst.set_model(model)
|
2013-10-03 01:10:11 +08:00
|
|
|
lst.set_row_separator_func(lambda m, i, ignore: m[i][0] is None, None)
|
2013-10-02 05:40:44 +08:00
|
|
|
|
2010-03-05 04:31:33 +08:00
|
|
|
# Sparse tooltip
|
2011-07-15 01:13:13 +08:00
|
|
|
sparse_info = self.widget("config-storage-nosparse-info")
|
2010-03-05 04:31:33 +08:00
|
|
|
uihelpers.set_sparse_tooltip(sparse_info)
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def reset_state(self, urihint=None):
|
2009-07-07 04:49:47 +08:00
|
|
|
self.failed_guest = None
|
2011-03-16 04:33:55 +08:00
|
|
|
self.have_startup_error = False
|
2010-12-08 05:48:13 +08:00
|
|
|
self.guest = None
|
|
|
|
self.disk = None
|
|
|
|
self.nic = None
|
2011-07-26 06:53:09 +08:00
|
|
|
self.show_all_os = False
|
2010-12-08 05:48:13 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-pages").set_current_page(PAGE_NAME)
|
2009-03-10 04:16:45 +08:00
|
|
|
self.page_changed(None, None, PAGE_NAME)
|
2006-11-07 00:36:55 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Name page state
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-vm-name").set_text("")
|
|
|
|
self.widget("method-local").set_active(True)
|
|
|
|
self.widget("create-conn").set_active(-1)
|
2009-03-10 04:16:45 +08:00
|
|
|
activeconn = self.populate_conn_list(urihint)
|
2013-10-02 03:18:34 +08:00
|
|
|
self.widget("arch-expander").set_expanded(False)
|
2010-02-11 09:26:40 +08:00
|
|
|
|
|
|
|
try:
|
2010-02-13 02:37:04 +08:00
|
|
|
self.set_conn(activeconn, force_validate=True)
|
2010-02-11 09:26:40 +08:00
|
|
|
except Exception, e:
|
|
|
|
logging.exception("Error setting create wizard conn state.")
|
|
|
|
return self.startup_error(str(e))
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
if not activeconn:
|
2010-02-11 09:26:40 +08:00
|
|
|
return self.startup_error(
|
|
|
|
_("No active connection to install on."))
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Everything from this point forward should be connection independent
|
|
|
|
|
|
|
|
# Distro/Variant
|
2011-07-15 01:13:13 +08:00
|
|
|
self.toggle_detect_os(self.widget("install-detect-os"))
|
2007-04-16 01:41:12 +08:00
|
|
|
self.populate_os_type_model()
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-os-type").set_active(0)
|
2007-04-24 03:08:56 +08:00
|
|
|
|
2012-05-14 21:24:56 +08:00
|
|
|
self.widget("install-local-box").get_child().set_text("")
|
2011-07-15 01:13:13 +08:00
|
|
|
iso_model = self.widget("install-local-box").get_model()
|
2013-04-18 05:39:25 +08:00
|
|
|
self.populate_media_model(iso_model, self.config.get_iso_paths())
|
2007-07-10 09:13:56 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Install URL
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-urlopts-entry").set_text("")
|
2012-05-14 21:24:56 +08:00
|
|
|
self.widget("install-ks-box").get_child().set_text("")
|
|
|
|
self.widget("install-url-box").get_child().set_text("")
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-url-options").set_expanded(False)
|
|
|
|
urlmodel = self.widget("install-url-box").get_model()
|
|
|
|
ksmodel = self.widget("install-ks-box").get_model()
|
2009-05-11 23:00:03 +08:00
|
|
|
self.populate_media_model(urlmodel, self.config.get_media_urls())
|
|
|
|
self.populate_media_model(ksmodel, self.config.get_kickstart_urls())
|
2013-10-05 22:29:16 +08:00
|
|
|
self.set_distro_labels("-", "-", force=True)
|
2007-07-15 02:43:52 +08:00
|
|
|
|
2010-03-23 06:15:18 +08:00
|
|
|
# Install import
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-import-entry").set_text("")
|
2013-10-02 23:56:51 +08:00
|
|
|
self.widget("config-kernel").set_text("")
|
|
|
|
self.widget("config-initrd").set_text("")
|
|
|
|
self.widget("config-dtb").set_text("")
|
2010-03-23 06:15:18 +08:00
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
# Install container app
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-app-entry").set_text("/bin/sh")
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2011-06-21 23:04:22 +08:00
|
|
|
# Install container OS
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-oscontainer-fs").set_text("")
|
2011-06-21 23:04:22 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Mem / CPUs
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-mem").set_value(DEFAULT_MEM)
|
|
|
|
self.widget("config-cpus").set_value(1)
|
2007-04-16 01:41:12 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Storage
|
2011-07-15 01:13:13 +08:00
|
|
|
label_widget = self.widget("phys-hd-label")
|
2010-12-14 05:12:55 +08:00
|
|
|
label_widget.set_markup("")
|
2013-07-08 07:00:57 +08:00
|
|
|
uihelpers.update_host_space(self.conn, label_widget)
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("enable-storage").set_active(True)
|
|
|
|
self.widget("config-storage-create").set_active(True)
|
|
|
|
self.widget("config-storage-size").set_value(8)
|
|
|
|
self.widget("config-storage-entry").set_text("")
|
|
|
|
self.widget("config-storage-nosparse").set_active(True)
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2014-01-15 05:03:58 +08:00
|
|
|
fmt = self.conn.get_default_storage_format()
|
|
|
|
can_alloc = fmt in ["raw"]
|
|
|
|
self.widget("config-storage-nosparse").set_active(can_alloc)
|
|
|
|
self.widget("config-storage-nosparse").set_sensitive(can_alloc)
|
|
|
|
self.widget("config-storage-nosparse").set_tooltip_text(
|
|
|
|
not can_alloc and
|
|
|
|
(_("Disk format '%s' does not support full allocation.") % fmt) or
|
|
|
|
"")
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Final page
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("summary-customize").set_active(False)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-03-24 21:57:31 +08:00
|
|
|
# Make sure window is a sane size
|
|
|
|
self.topwin.resize(1, 1)
|
2010-02-13 02:37:04 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
def set_caps_state(self):
|
|
|
|
# State that is dependent on when capsguest changes
|
|
|
|
|
2012-02-09 22:50:54 +08:00
|
|
|
# Helper state
|
2009-03-10 04:16:45 +08:00
|
|
|
is_local = not self.conn.is_remote()
|
|
|
|
is_storage_capable = self.conn.is_storage_capable()
|
2012-02-09 22:50:54 +08:00
|
|
|
can_storage = (is_local or is_storage_capable)
|
2009-03-10 04:16:45 +08:00
|
|
|
is_pv = (self.capsguest.os_type == "xen")
|
2011-06-08 05:42:50 +08:00
|
|
|
is_container = self.conn.is_container()
|
2013-10-06 22:08:04 +08:00
|
|
|
can_remote_url = self.conn.get_backend().support_remote_url_install()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
installable_arch = (self.capsguest.arch in
|
|
|
|
["i686", "x86_64", "ppc64", "ia64"])
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Install Options
|
2011-07-15 01:13:13 +08:00
|
|
|
method_tree = self.widget("method-tree")
|
|
|
|
method_pxe = self.widget("method-pxe")
|
|
|
|
method_local = self.widget("method-local")
|
2012-02-09 22:50:54 +08:00
|
|
|
method_import = self.widget("method-import")
|
2011-07-15 01:13:13 +08:00
|
|
|
method_container_app = self.widget("method-container-app")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
method_tree.set_sensitive((is_local or can_remote_url) and
|
|
|
|
installable_arch)
|
|
|
|
method_local.set_sensitive(not is_pv and can_storage and
|
|
|
|
installable_arch)
|
|
|
|
method_pxe.set_sensitive(not is_pv and installable_arch)
|
2012-02-09 22:50:54 +08:00
|
|
|
method_import.set_sensitive(can_storage)
|
|
|
|
virt_methods = [method_local, method_tree, method_pxe, method_import]
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
pxe_tt = None
|
|
|
|
local_tt = None
|
|
|
|
tree_tt = None
|
2012-02-09 22:50:54 +08:00
|
|
|
import_tt = None
|
|
|
|
|
|
|
|
if not is_local:
|
|
|
|
if not can_remote_url:
|
|
|
|
tree_tt = _("Libvirt version does not "
|
|
|
|
"support remote URL installs.")
|
|
|
|
if not is_storage_capable:
|
|
|
|
local_tt = _("Connection does not support storage management.")
|
|
|
|
import_tt = local_tt
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
if is_pv:
|
|
|
|
base = _("%s installs not available for paravirt guests.")
|
|
|
|
pxe_tt = base % "PXE"
|
|
|
|
local_tt = base % "CDROM/ISO"
|
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
if not installable_arch:
|
|
|
|
msg = (_("Architecture '%s' is not installable") %
|
|
|
|
self.capsguest.arch)
|
|
|
|
tree_tt = msg
|
|
|
|
local_tt = msg
|
|
|
|
pxe_tt = msg
|
|
|
|
|
2014-01-13 03:41:25 +08:00
|
|
|
if not any([w.get_active() and w.get_sensitive()
|
|
|
|
for w in virt_methods]):
|
|
|
|
for w in virt_methods:
|
|
|
|
if w.get_sensitive():
|
|
|
|
w.set_active(True)
|
|
|
|
break
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2012-02-09 22:50:54 +08:00
|
|
|
if not (is_container or
|
2013-04-12 04:32:00 +08:00
|
|
|
[w for w in virt_methods if w.get_sensitive()]):
|
2012-02-09 22:50:54 +08:00
|
|
|
return self.startup_error(
|
|
|
|
_("No install methods available for this connection."),
|
|
|
|
hideinstall=False)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2012-05-14 21:24:56 +08:00
|
|
|
method_tree.set_tooltip_text(tree_tt or "")
|
|
|
|
method_local.set_tooltip_text(local_tt or "")
|
|
|
|
method_pxe.set_tooltip_text(pxe_tt or "")
|
|
|
|
method_import.set_tooltip_text(import_tt or "")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
# Container install options
|
|
|
|
method_container_app.set_active(True)
|
2013-09-02 08:18:14 +08:00
|
|
|
self.widget("virt-install-box").set_visible(not is_container)
|
|
|
|
self.widget("container-install-box").set_visible(is_container)
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
show_kernel = (self.capsguest.arch not in ["x86_64", "i686"])
|
|
|
|
show_dtb = ("arm" in self.capsguest.arch or
|
|
|
|
"microblaze" in self.capsguest.arch or
|
|
|
|
"ppc" in self.capsguest.arch)
|
|
|
|
self.widget("config-kernel-box").set_visible(show_kernel)
|
|
|
|
uihelpers.set_grid_row_visible(self.widget("config-dtb"), show_dtb)
|
|
|
|
|
2013-10-02 19:35:02 +08:00
|
|
|
def set_conn_state(self):
|
|
|
|
# Update all state that has some dependency on the current connection
|
|
|
|
self.conn.schedule_priority_tick(pollnet=True,
|
|
|
|
pollpool=True, polliface=True,
|
|
|
|
pollnodedev=True, pollmedia=True)
|
|
|
|
|
|
|
|
self.widget("install-box").show()
|
|
|
|
self.widget("startup-error-box").hide()
|
|
|
|
self.widget("create-forward").set_sensitive(True)
|
|
|
|
|
|
|
|
if self.conn.caps.no_install_options():
|
|
|
|
error = _("No hypervisor options were found for this "
|
|
|
|
"connection.")
|
|
|
|
|
|
|
|
if self.conn.is_qemu():
|
|
|
|
error += "\n\n"
|
|
|
|
error += _("This usually means that QEMU or KVM is not "
|
|
|
|
"installed on your machine, or the KVM kernel "
|
|
|
|
"modules are not loaded.")
|
|
|
|
return self.startup_error(error)
|
|
|
|
|
|
|
|
# A bit out of order, but populate arch + hv lists so we can
|
|
|
|
# determine a default
|
|
|
|
self.conn.invalidate_caps()
|
|
|
|
self.caps = self.conn.caps
|
|
|
|
self.change_caps()
|
|
|
|
self.populate_hv()
|
|
|
|
self.populate_arch()
|
|
|
|
|
|
|
|
show_arch = (self.widget("config-hv").get_visible() or
|
|
|
|
self.widget("config-arch").get_visible() or
|
|
|
|
self.widget("config-machine").get_visible())
|
|
|
|
uihelpers.set_grid_row_visible(self.widget("arch-expander"), show_arch)
|
|
|
|
|
|
|
|
if self.conn.is_xen():
|
|
|
|
if self.conn.caps.hw_virt_supported():
|
|
|
|
if self.conn.caps.is_bios_virt_disabled():
|
|
|
|
error = _("Host supports full virtualization, but "
|
|
|
|
"no related install options are available. "
|
|
|
|
"This may mean support is disabled in your "
|
|
|
|
"system BIOS.")
|
|
|
|
self.startup_warning(error)
|
|
|
|
|
|
|
|
else:
|
|
|
|
error = _("Host does not appear to support hardware "
|
|
|
|
"virtualization. Install options may be limited.")
|
|
|
|
self.startup_warning(error)
|
|
|
|
|
|
|
|
elif self.conn.is_qemu():
|
|
|
|
if not self.conn.caps.is_kvm_available():
|
|
|
|
error = _("KVM is not available. This may mean the KVM "
|
|
|
|
"package is not installed, or the KVM kernel modules "
|
|
|
|
"are not loaded. Your virtual machines may perform poorly.")
|
|
|
|
self.startup_warning(error)
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Install local
|
2011-07-15 01:13:13 +08:00
|
|
|
iso_option = self.widget("install-local-iso")
|
|
|
|
cdrom_option = self.widget("install-local-cdrom")
|
|
|
|
cdrom_list = self.widget("install-local-cdrom-combo")
|
|
|
|
cdrom_warn = self.widget("install-local-cdrom-warn")
|
2009-12-01 01:51:25 +08:00
|
|
|
|
2009-12-11 09:04:26 +08:00
|
|
|
sigs = uihelpers.populate_mediadev_combo(self.conn, cdrom_list,
|
|
|
|
MEDIA_CDROM)
|
2009-12-01 01:51:25 +08:00
|
|
|
self.conn_signals.extend(sigs)
|
|
|
|
|
2009-12-11 09:04:26 +08:00
|
|
|
if self.conn.mediadev_error:
|
2009-12-01 01:51:25 +08:00
|
|
|
cdrom_warn.show()
|
2009-12-01 00:56:41 +08:00
|
|
|
cdrom_option.set_sensitive(False)
|
2012-05-14 21:24:56 +08:00
|
|
|
cdrom_warn.set_tooltip_text(self.conn.mediadev_error)
|
2009-12-01 01:51:25 +08:00
|
|
|
else:
|
|
|
|
cdrom_warn.hide()
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Don't select physical CDROM if no valid media is present
|
2009-12-01 00:56:41 +08:00
|
|
|
use_cd = (cdrom_list.get_active() >= 0)
|
2009-03-10 04:16:45 +08:00
|
|
|
if use_cd:
|
2009-11-16 05:36:37 +08:00
|
|
|
cdrom_option.set_active(True)
|
2006-08-10 06:53:30 +08:00
|
|
|
else:
|
2009-11-16 05:36:37 +08:00
|
|
|
iso_option.set_active(True)
|
|
|
|
|
|
|
|
# Only allow ISO option for remote VM
|
2013-10-02 19:35:02 +08:00
|
|
|
is_local = not self.conn.is_remote()
|
|
|
|
is_storage_capable = self.conn.is_storage_capable()
|
|
|
|
can_storage = (is_local or is_storage_capable)
|
2009-11-16 05:36:37 +08:00
|
|
|
if not is_local:
|
|
|
|
iso_option.set_active(True)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2009-11-16 05:36:37 +08:00
|
|
|
self.toggle_local_cdrom(cdrom_option)
|
|
|
|
self.toggle_local_iso(iso_option)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Memory
|
|
|
|
memory = int(self.conn.host_memory_size())
|
2010-12-11 00:47:07 +08:00
|
|
|
mem_label = (_("Up to %(maxmem)s available on the host") %
|
|
|
|
{'maxmem': self.pretty_memory(memory)})
|
2009-03-10 04:16:45 +08:00
|
|
|
mem_label = ("<span size='small' color='#484848'>%s</span>" %
|
|
|
|
mem_label)
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-mem").set_range(50, memory / 1024)
|
|
|
|
self.widget("phys-mem-label").set_markup(mem_label)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# CPU
|
2013-07-07 00:36:07 +08:00
|
|
|
phys_cpus = int(self.conn.host_active_processor_count())
|
2009-03-10 04:16:45 +08:00
|
|
|
cmax = phys_cpus
|
2009-03-10 10:42:17 +08:00
|
|
|
if cmax <= 0:
|
|
|
|
cmax = 1
|
2010-12-11 00:47:07 +08:00
|
|
|
cpu_label = (_("Up to %(numcpus)d available") %
|
|
|
|
{'numcpus': int(phys_cpus)})
|
2009-03-10 04:16:45 +08:00
|
|
|
cpu_label = ("<span size='small' color='#484848'>%s</span>" %
|
|
|
|
cpu_label)
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-cpus").set_range(1, cmax)
|
|
|
|
self.widget("phys-cpu-label").set_markup(cpu_label)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Storage
|
|
|
|
storage_tooltip = None
|
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
use_storage = self.widget("config-storage-select")
|
|
|
|
storage_area = self.widget("config-storage-area")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2012-02-09 22:50:54 +08:00
|
|
|
storage_area.set_sensitive(can_storage)
|
|
|
|
if not can_storage:
|
2009-03-10 04:16:45 +08:00
|
|
|
storage_tooltip = _("Connection does not support storage"
|
|
|
|
" management.")
|
|
|
|
use_storage.set_sensitive(True)
|
2012-05-14 21:24:56 +08:00
|
|
|
storage_area.set_tooltip_text(storage_tooltip or "")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Networking
|
2011-07-15 01:13:13 +08:00
|
|
|
net_list = self.widget("config-netdev")
|
|
|
|
net_warn_icon = self.widget("config-netdev-warn-icon")
|
|
|
|
net_warn_box = self.widget("config-netdev-warn-box")
|
2013-10-03 00:12:26 +08:00
|
|
|
net_expander = self.widget("config-advanced-expander")
|
2011-04-16 03:33:56 +08:00
|
|
|
net_warn_icon.hide()
|
|
|
|
net_warn_box.hide()
|
|
|
|
net_expander.set_expanded(False)
|
2010-02-13 02:37:04 +08:00
|
|
|
|
2011-04-06 22:07:12 +08:00
|
|
|
do_warn = uihelpers.populate_network_list(net_list, self.conn, False)
|
2010-12-05 01:28:44 +08:00
|
|
|
self.set_net_warn(self.conn.netdev_error or do_warn,
|
|
|
|
self.conn.netdev_error, True)
|
2009-12-01 01:51:25 +08:00
|
|
|
|
2013-07-16 02:14:05 +08:00
|
|
|
newmac = virtinst.VirtualNetworkInterface.generate_mac(
|
|
|
|
self.conn.get_backend())
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-set-macaddr").set_active(bool(newmac))
|
|
|
|
self.widget("config-macaddr").set_text(newmac)
|
2006-08-10 06:53:30 +08:00
|
|
|
|
2010-12-05 01:28:44 +08:00
|
|
|
def set_net_warn(self, show_warn, msg, do_tooltip):
|
2011-07-15 01:13:13 +08:00
|
|
|
net_warn_icon = self.widget("config-netdev-warn-icon")
|
|
|
|
net_warn_box = self.widget("config-netdev-warn-box")
|
|
|
|
net_warn_label = self.widget("config-netdev-warn-label")
|
|
|
|
net_expander = self.widget("config-advanced-expander")
|
2010-12-05 01:28:44 +08:00
|
|
|
|
|
|
|
if show_warn:
|
|
|
|
net_expander.set_expanded(True)
|
|
|
|
|
|
|
|
if do_tooltip:
|
Fix a problem in the create window
This error is fixed:
Traceback (most recent call last):
File "src/virt-manager/virtManager/create.py", line 335, in reset_state
self.set_conn(activeconn, force_validate=True)
File "src/virt-manager/virtManager/create.py", line 201, in set_conn
self.set_conn_state()
File "src/virt-manager/virtManager/create.py", line 594, in set_conn_state
self.conn.netdev_error, True)
File "src/virt-manager/virtManager/create.py", line 611, in set_net_warn
net_warn_icon.set_visible(show_warn)
File "/usr/lib/python2.7/site-packages/gi/types.py", line 113, in function
return info.invoke(*args, **kwargs)
TypeError: Argument 1 does not allow None as a value
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2013-10-02 21:37:52 +08:00
|
|
|
net_warn_icon.set_visible(bool(show_warn))
|
2010-12-05 01:28:44 +08:00
|
|
|
if msg:
|
2012-05-14 21:24:56 +08:00
|
|
|
net_warn_icon.set_tooltip_text(show_warn and msg or "")
|
2010-12-05 01:28:44 +08:00
|
|
|
else:
|
2013-09-02 08:18:14 +08:00
|
|
|
net_warn_box.set_visible(show_warn)
|
2010-12-05 01:28:44 +08:00
|
|
|
markup = show_warn and ("<small>%s</small>" % msg) or ""
|
|
|
|
net_warn_label.set_markup(markup)
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def populate_hv(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
hv_list = self.widget("config-hv")
|
2009-03-10 04:16:45 +08:00
|
|
|
model = hv_list.get_model()
|
|
|
|
model.clear()
|
|
|
|
|
|
|
|
default = 0
|
2013-10-02 05:27:58 +08:00
|
|
|
guests = self.caps.guests[:]
|
|
|
|
if not (self.conn.is_xen() or self.conn.is_test_conn()):
|
|
|
|
guests = []
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
for guest in self.caps.guests:
|
|
|
|
gtype = guest.os_type
|
2013-10-02 05:27:58 +08:00
|
|
|
if not guest.domains:
|
|
|
|
continue
|
|
|
|
dom = guest.domains[0]
|
|
|
|
domtype = dom.hypervisor_type
|
|
|
|
label = uihelpers.pretty_hv(gtype, domtype)
|
|
|
|
|
|
|
|
# Don't add multiple rows for each arch
|
|
|
|
for m in model:
|
|
|
|
if m[0] == label:
|
|
|
|
label = None
|
|
|
|
break
|
|
|
|
if label is None:
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Determine if this is the default given by guest_lookup
|
|
|
|
if (gtype == self.capsguest.os_type and
|
|
|
|
self.capsdomain.hypervisor_type == domtype):
|
|
|
|
default = len(model)
|
2006-08-09 23:40:34 +08:00
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
model.append([label, gtype])
|
|
|
|
|
|
|
|
show = bool(guests)
|
|
|
|
uihelpers.set_grid_row_visible(hv_list, show)
|
|
|
|
if show:
|
|
|
|
hv_list.set_active(default)
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def populate_arch(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
arch_list = self.widget("config-arch")
|
2009-03-10 04:16:45 +08:00
|
|
|
model = arch_list.get_model()
|
|
|
|
model.clear()
|
|
|
|
|
|
|
|
default = 0
|
2013-10-02 05:27:58 +08:00
|
|
|
archs = []
|
2009-03-10 04:16:45 +08:00
|
|
|
for guest in self.caps.guests:
|
2013-10-02 05:27:58 +08:00
|
|
|
if guest.os_type == self.capsguest.os_type:
|
|
|
|
archs.append(guest.arch)
|
|
|
|
|
|
|
|
# Combine x86/i686 to avoid confusion
|
2014-01-19 02:23:30 +08:00
|
|
|
if (self.conn.caps.host.cpu.arch == "x86_64" and
|
2013-10-03 01:10:11 +08:00
|
|
|
"x86_64" in archs and "i686" in archs):
|
2013-10-02 05:27:58 +08:00
|
|
|
archs.remove("i686")
|
2013-10-03 01:10:11 +08:00
|
|
|
archs.sort()
|
|
|
|
|
|
|
|
prios = ["x86_64", "i686", "armv7l", "ppc64"]
|
2014-01-19 02:23:30 +08:00
|
|
|
if self.conn.caps.host.cpu.arch not in prios:
|
2013-10-03 01:10:11 +08:00
|
|
|
prios = []
|
|
|
|
else:
|
|
|
|
for p in prios[:]:
|
|
|
|
if p not in archs:
|
|
|
|
prios.remove(p)
|
|
|
|
else:
|
|
|
|
archs.remove(p)
|
|
|
|
if prios:
|
|
|
|
if archs:
|
|
|
|
prios += [None]
|
|
|
|
archs = prios + archs
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
default = 0
|
|
|
|
if self.capsguest.arch in archs:
|
|
|
|
default = archs.index(self.capsguest.arch)
|
2013-10-03 01:10:11 +08:00
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
for arch in archs:
|
2013-10-03 01:10:11 +08:00
|
|
|
model.append([arch, pretty_arch(arch)])
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
show = not (len(archs) < 2)
|
|
|
|
uihelpers.set_grid_row_visible(arch_list, show)
|
2009-03-10 04:16:45 +08:00
|
|
|
arch_list.set_active(default)
|
|
|
|
|
2013-10-02 05:40:44 +08:00
|
|
|
def populate_machine(self):
|
|
|
|
lst = self.widget("config-machine")
|
|
|
|
model = lst.get_model()
|
|
|
|
model.clear()
|
|
|
|
|
|
|
|
machines = self.capsdomain.machines
|
|
|
|
if self.capsguest.arch in ["i686", "x86_64"]:
|
|
|
|
machines = []
|
2013-10-03 01:10:11 +08:00
|
|
|
machines.sort()
|
2013-10-02 05:40:44 +08:00
|
|
|
|
|
|
|
defmachine = None
|
2013-10-03 01:10:11 +08:00
|
|
|
prios = []
|
2013-10-02 05:40:44 +08:00
|
|
|
if self.capsguest.arch == "armv7l":
|
|
|
|
defmachine = "vexpress-a9"
|
2013-10-03 01:10:11 +08:00
|
|
|
prios = ["vexpress-a9", "vexpress-a15", "highbank", "midway"]
|
2013-10-02 05:40:44 +08:00
|
|
|
elif self.capsguest.arch == "ppc64":
|
|
|
|
defmachine = "pseries"
|
2013-10-03 01:10:11 +08:00
|
|
|
prios = ["pseries"]
|
|
|
|
|
|
|
|
for p in prios[:]:
|
|
|
|
if p not in machines:
|
|
|
|
prios.remove(p)
|
|
|
|
else:
|
|
|
|
machines.remove(p)
|
|
|
|
if prios:
|
|
|
|
machines = prios + [None] + machines
|
2013-10-02 05:40:44 +08:00
|
|
|
|
|
|
|
default = 0
|
2013-10-03 01:10:11 +08:00
|
|
|
if defmachine and defmachine in machines:
|
2013-10-02 05:40:44 +08:00
|
|
|
default = machines.index(defmachine)
|
|
|
|
|
|
|
|
for m in machines:
|
|
|
|
model.append([m])
|
|
|
|
|
|
|
|
show = (len(machines) > 1)
|
|
|
|
uihelpers.set_grid_row_visible(lst, show)
|
|
|
|
if show:
|
|
|
|
lst.set_active(default)
|
2013-10-02 23:56:51 +08:00
|
|
|
else:
|
|
|
|
lst.emit("changed")
|
2013-10-02 05:40:44 +08:00
|
|
|
|
2010-12-11 00:47:07 +08:00
|
|
|
def populate_conn_list(self, urihint=None):
|
2011-07-15 01:13:13 +08:00
|
|
|
conn_list = self.widget("create-conn")
|
2009-03-10 04:16:45 +08:00
|
|
|
model = conn_list.get_model()
|
|
|
|
model.clear()
|
|
|
|
|
|
|
|
default = -1
|
2011-07-23 04:43:26 +08:00
|
|
|
for c in self.engine.conns.values():
|
|
|
|
connobj = c["conn"]
|
2009-03-10 04:16:45 +08:00
|
|
|
if not connobj.is_active():
|
|
|
|
continue
|
|
|
|
|
|
|
|
if connobj.get_uri() == urihint:
|
|
|
|
default = len(model)
|
|
|
|
elif default < 0 and not connobj.is_remote():
|
|
|
|
# Favor local connections over remote connections
|
|
|
|
default = len(model)
|
|
|
|
|
2009-07-21 02:47:50 +08:00
|
|
|
model.append([connobj.get_uri(), connobj.get_pretty_desc_active()])
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
no_conns = (len(model) == 0)
|
|
|
|
|
|
|
|
if default < 0 and not no_conns:
|
|
|
|
default = 0
|
|
|
|
|
|
|
|
activeuri = ""
|
|
|
|
activedesc = ""
|
|
|
|
activeconn = None
|
|
|
|
if not no_conns:
|
|
|
|
conn_list.set_active(default)
|
|
|
|
activeuri, activedesc = model[default]
|
2011-07-23 04:43:26 +08:00
|
|
|
activeconn = self.engine.conns[activeuri]["conn"]
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-conn-label").set_text(activedesc)
|
2009-03-10 04:16:45 +08:00
|
|
|
if len(model) <= 1:
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-conn").hide()
|
|
|
|
self.widget("create-conn-label").show()
|
2006-09-13 05:49:29 +08:00
|
|
|
else:
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-conn").show()
|
|
|
|
self.widget("create-conn-label").hide()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
return activeconn
|
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
def _add_os_row(self, model, name="", label="", supported=False,
|
|
|
|
sep=False, action=False):
|
|
|
|
visible = self.show_all_os or supported
|
|
|
|
if sep or action:
|
|
|
|
visible = not self.show_all_os
|
|
|
|
|
|
|
|
if not visible:
|
|
|
|
return
|
|
|
|
|
|
|
|
model.append([name, label, sep, action])
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def populate_os_type_model(self):
|
2011-07-26 06:53:09 +08:00
|
|
|
widget = self.widget("install-os-type")
|
|
|
|
model = widget.get_model()
|
2009-03-10 04:16:45 +08:00
|
|
|
model.clear()
|
2014-01-21 00:09:13 +08:00
|
|
|
filtervars = (self._stable_defaults() and
|
|
|
|
STABLE_OS_SUPPORT or
|
2011-07-26 07:13:38 +08:00
|
|
|
None)
|
2012-10-25 03:12:19 +08:00
|
|
|
|
2013-08-12 02:52:30 +08:00
|
|
|
types = virtinst.osdict.list_os(list_types=True)
|
2012-10-25 03:20:56 +08:00
|
|
|
if not filtervars:
|
|
|
|
# Kind of a hack, just show linux + windows by default since
|
|
|
|
# that's all 98% of people care about
|
|
|
|
supportl = ["linux", "windows"]
|
2013-08-12 02:52:30 +08:00
|
|
|
else:
|
|
|
|
supportl = []
|
|
|
|
for t in types:
|
|
|
|
l = virtinst.osdict.list_os(typename=t.name,
|
|
|
|
only_supported=True,
|
|
|
|
filtervars=filtervars)
|
|
|
|
if l:
|
|
|
|
supportl.append(t.name)
|
2011-07-26 06:53:09 +08:00
|
|
|
|
2012-02-14 07:35:56 +08:00
|
|
|
self._add_os_row(model, None, _("Generic"), True)
|
2011-07-26 06:53:09 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
for t in types:
|
2013-08-12 02:52:30 +08:00
|
|
|
supported = (t.name in supportl)
|
|
|
|
self._add_os_row(model, t.name, t.label, supported)
|
2011-07-26 06:53:09 +08:00
|
|
|
|
|
|
|
# Add sep
|
|
|
|
self._add_os_row(model, sep=True)
|
|
|
|
# Add action option
|
|
|
|
self._add_os_row(model, label=_("Show all OS options"), action=True)
|
|
|
|
widget.set_active(0)
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def populate_os_variant_model(self, _type):
|
2011-07-15 01:13:13 +08:00
|
|
|
model = self.widget("install-os-version").get_model()
|
2009-03-10 04:16:45 +08:00
|
|
|
model.clear()
|
2012-10-25 03:20:17 +08:00
|
|
|
if not _type:
|
2012-02-14 07:35:56 +08:00
|
|
|
self._add_os_row(model, None, _("Generic"), True)
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
|
|
|
|
2014-01-21 00:09:13 +08:00
|
|
|
filtervars = (not self._stable_defaults() and
|
|
|
|
STABLE_OS_SUPPORT or
|
2011-07-26 07:13:38 +08:00
|
|
|
None)
|
2010-12-14 05:02:59 +08:00
|
|
|
preferred = self.config.preferred_distros
|
2013-08-12 02:52:30 +08:00
|
|
|
|
|
|
|
variants = virtinst.osdict.list_os(typename=_type,
|
|
|
|
sortpref=preferred)
|
|
|
|
supportl = virtinst.osdict.list_os(typename=_type,
|
|
|
|
sortpref=preferred,
|
|
|
|
only_supported=True,
|
|
|
|
filtervars=filtervars)
|
2011-07-26 06:53:09 +08:00
|
|
|
|
|
|
|
for v in variants:
|
|
|
|
supported = v in supportl
|
2013-08-12 02:52:30 +08:00
|
|
|
self._add_os_row(model, v.name, v.label, supported)
|
2011-07-26 06:53:09 +08:00
|
|
|
|
|
|
|
# Add sep
|
|
|
|
self._add_os_row(model, sep=True)
|
|
|
|
# Add action option
|
|
|
|
self._add_os_row(model, label=_("Show all OS options"), action=True)
|
|
|
|
|
2009-05-11 23:00:03 +08:00
|
|
|
def populate_media_model(self, model, urls):
|
2009-03-10 04:16:45 +08:00
|
|
|
model.clear()
|
2012-05-14 21:24:56 +08:00
|
|
|
if urls is not None:
|
|
|
|
for url in urls:
|
|
|
|
model.append([url])
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
def change_caps(self, gtype=None, arch=None):
|
2012-11-08 21:15:02 +08:00
|
|
|
if gtype is None:
|
2009-03-14 02:37:15 +08:00
|
|
|
# If none specified, prefer HVM. This way, the default install
|
|
|
|
# options won't be limited because we default to PV. If hvm not
|
|
|
|
# supported, differ to guest_lookup
|
|
|
|
for g in self.caps.guests:
|
|
|
|
if g.os_type == "hvm":
|
|
|
|
gtype = "hvm"
|
|
|
|
break
|
|
|
|
|
2013-07-07 02:12:13 +08:00
|
|
|
(newg, newdom) = self.caps.guest_lookup(os_type=gtype,
|
2013-07-05 20:59:58 +08:00
|
|
|
accelerated=True,
|
|
|
|
arch=arch)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
if (self.capsguest and self.capsdomain and
|
|
|
|
(newg.arch == self.capsguest.arch and
|
2013-10-02 05:27:58 +08:00
|
|
|
newg.os_type == self.capsguest.os_type)):
|
2009-03-10 04:16:45 +08:00
|
|
|
# No change
|
|
|
|
return
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
self.capsguest = newg
|
|
|
|
self.capsdomain = newdom
|
2012-01-17 11:04:40 +08:00
|
|
|
logging.debug("Guest type set to os_type=%s, arch=%s, dom_type=%s",
|
|
|
|
self.capsguest.os_type,
|
|
|
|
self.capsguest.arch,
|
|
|
|
self.capsdomain.hypervisor_type)
|
2013-10-02 05:40:44 +08:00
|
|
|
self.populate_machine()
|
2013-10-02 23:56:51 +08:00
|
|
|
self.set_caps_state()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def populate_summary(self):
|
2012-02-14 07:35:56 +08:00
|
|
|
distro, version, dlabel, vlabel = self.get_config_os_info()
|
2013-07-14 11:07:01 +08:00
|
|
|
mem = self.pretty_memory(int(self.guest.memory))
|
2009-03-10 04:16:45 +08:00
|
|
|
cpu = str(int(self.guest.vcpus))
|
|
|
|
|
|
|
|
instmethod = self.get_config_install_page()
|
|
|
|
install = ""
|
|
|
|
if instmethod == INSTALL_PAGE_ISO:
|
|
|
|
install = _("Local CDROM/ISO")
|
|
|
|
elif instmethod == INSTALL_PAGE_URL:
|
|
|
|
install = _("URL Install Tree")
|
|
|
|
elif instmethod == INSTALL_PAGE_PXE:
|
|
|
|
install = _("PXE Install")
|
2010-03-23 06:15:18 +08:00
|
|
|
elif instmethod == INSTALL_PAGE_IMPORT:
|
|
|
|
install = _("Import existing OS image")
|
2011-06-08 05:42:50 +08:00
|
|
|
elif instmethod == INSTALL_PAGE_CONTAINER_APP:
|
|
|
|
install = _("Application container")
|
2011-06-21 23:04:22 +08:00
|
|
|
elif instmethod == INSTALL_PAGE_CONTAINER_OS:
|
2011-06-08 05:42:50 +08:00
|
|
|
install = _("Operating system container")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-06-21 23:04:22 +08:00
|
|
|
storagetmpl = "<span size='small' color='#484848'>%s</span>"
|
2013-04-12 21:39:34 +08:00
|
|
|
disks = self.guest.get_devices("disk")
|
|
|
|
if disks:
|
|
|
|
disk = disks[0]
|
2013-07-13 22:09:00 +08:00
|
|
|
storage = "%s" % self.pretty_storage(disk.get_size())
|
2011-06-21 23:04:22 +08:00
|
|
|
storage += " " + (storagetmpl % disk.path)
|
|
|
|
elif len(self.guest.get_devices("filesystem")):
|
|
|
|
fs = self.guest.get_devices("filesystem")[0]
|
|
|
|
storage = storagetmpl % fs.source
|
2013-07-17 19:53:47 +08:00
|
|
|
elif self.guest.os.is_container():
|
2011-06-21 23:04:22 +08:00
|
|
|
storage = _("Host filesystem")
|
|
|
|
else:
|
|
|
|
storage = _("None")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
osstr = ""
|
2012-02-14 07:35:56 +08:00
|
|
|
have_os = True
|
2013-07-17 19:53:47 +08:00
|
|
|
if self.guest.os.is_container():
|
2011-06-21 23:04:22 +08:00
|
|
|
osstr = _("Linux")
|
2012-02-14 07:35:56 +08:00
|
|
|
elif not distro:
|
2009-03-10 04:16:45 +08:00
|
|
|
osstr = _("Generic")
|
2012-02-14 07:35:56 +08:00
|
|
|
have_os = False
|
|
|
|
elif not version:
|
2009-03-10 04:16:45 +08:00
|
|
|
osstr = _("Generic") + " " + dlabel
|
2012-02-14 07:35:56 +08:00
|
|
|
have_os = False
|
2007-03-22 00:28:36 +08:00
|
|
|
else:
|
2009-03-10 04:16:45 +08:00
|
|
|
osstr = vlabel
|
2007-03-22 00:28:36 +08:00
|
|
|
|
2013-09-02 08:18:14 +08:00
|
|
|
self.widget("finish-warn-os").set_visible(not have_os)
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("summary-os").set_text(osstr)
|
|
|
|
self.widget("summary-install").set_text(install)
|
|
|
|
self.widget("summary-mem").set_text(mem)
|
|
|
|
self.widget("summary-cpu").set_text(cpu)
|
|
|
|
self.widget("summary-storage").set_markup(storage)
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# get_* methods
|
|
|
|
def get_config_name(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
return self.widget("create-vm-name").get_text()
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
def get_config_machine(self):
|
|
|
|
lst = self.widget("config-machine")
|
|
|
|
idx = lst.get_active()
|
|
|
|
if not lst.get_visible() or idx == -1:
|
|
|
|
return None
|
|
|
|
return lst.get_model()[idx][0]
|
|
|
|
|
2010-12-05 02:22:04 +08:00
|
|
|
def is_install_page(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
notebook = self.widget("create-pages")
|
2010-12-05 02:22:04 +08:00
|
|
|
curpage = notebook.get_current_page()
|
|
|
|
return curpage == PAGE_INSTALL
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def get_config_install_page(self):
|
2013-09-09 23:02:34 +08:00
|
|
|
if self.widget("virt-install-box").get_visible():
|
2011-07-15 01:13:13 +08:00
|
|
|
if self.widget("method-local").get_active():
|
2011-06-08 05:42:50 +08:00
|
|
|
return INSTALL_PAGE_ISO
|
2011-07-15 01:13:13 +08:00
|
|
|
elif self.widget("method-tree").get_active():
|
2011-06-08 05:42:50 +08:00
|
|
|
return INSTALL_PAGE_URL
|
2011-07-15 01:13:13 +08:00
|
|
|
elif self.widget("method-pxe").get_active():
|
2011-06-08 05:42:50 +08:00
|
|
|
return INSTALL_PAGE_PXE
|
2011-07-15 01:13:13 +08:00
|
|
|
elif self.widget("method-import").get_active():
|
2011-06-08 05:42:50 +08:00
|
|
|
return INSTALL_PAGE_IMPORT
|
|
|
|
else:
|
2011-07-15 01:13:13 +08:00
|
|
|
if self.widget("method-container-app").get_active():
|
2011-06-08 05:42:50 +08:00
|
|
|
return INSTALL_PAGE_CONTAINER_APP
|
2011-07-15 01:13:13 +08:00
|
|
|
if self.widget("method-container-os").get_active():
|
2011-06-08 05:42:50 +08:00
|
|
|
return INSTALL_PAGE_CONTAINER_OS
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def get_config_os_info(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
d_list = self.widget("install-os-type")
|
2009-03-10 04:16:45 +08:00
|
|
|
d_idx = d_list.get_active()
|
2011-07-15 01:13:13 +08:00
|
|
|
v_list = self.widget("install-os-version")
|
2009-03-10 04:16:45 +08:00
|
|
|
v_idx = v_list.get_active()
|
|
|
|
distro = None
|
|
|
|
dlabel = None
|
|
|
|
variant = None
|
|
|
|
vlabel = None
|
|
|
|
|
|
|
|
if d_idx >= 0:
|
2011-07-26 06:53:09 +08:00
|
|
|
row = d_list.get_model()[d_idx]
|
|
|
|
distro = row[0]
|
|
|
|
dlabel = row[1]
|
2009-03-10 04:16:45 +08:00
|
|
|
if v_idx >= 0:
|
2011-07-26 06:53:09 +08:00
|
|
|
row = v_list.get_model()[v_idx]
|
|
|
|
variant = row[0]
|
|
|
|
vlabel = row[1]
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-01-13 05:13:53 +08:00
|
|
|
return (distro and str(distro),
|
|
|
|
variant and str(variant),
|
|
|
|
str(dlabel), str(vlabel))
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2009-05-11 23:00:03 +08:00
|
|
|
def get_config_local_media(self, store_media=False):
|
2011-07-15 01:13:13 +08:00
|
|
|
if self.widget("install-local-cdrom").get_active():
|
2013-01-13 05:13:53 +08:00
|
|
|
cd = self.widget("install-local-cdrom-combo")
|
|
|
|
idx = cd.get_active()
|
|
|
|
model = cd.get_model()
|
|
|
|
if idx != -1:
|
|
|
|
return model[idx][uihelpers.OPTICAL_DEV_PATH]
|
|
|
|
return None
|
2009-03-10 04:16:45 +08:00
|
|
|
else:
|
2012-05-14 21:24:56 +08:00
|
|
|
ret = self.widget("install-local-box").get_child().get_text()
|
2009-05-11 23:00:03 +08:00
|
|
|
if ret and store_media:
|
2013-04-18 05:39:25 +08:00
|
|
|
self.config.add_iso_path(ret)
|
2009-05-11 23:00:03 +08:00
|
|
|
return ret
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def get_config_detectable_media(self):
|
|
|
|
instpage = self.get_config_install_page()
|
|
|
|
media = ""
|
|
|
|
|
|
|
|
if instpage == INSTALL_PAGE_ISO:
|
|
|
|
media = self.get_config_local_media()
|
|
|
|
elif instpage == INSTALL_PAGE_URL:
|
2013-01-13 05:13:53 +08:00
|
|
|
media = self.widget("install-url-box").get_child().get_text()
|
2010-03-23 06:15:18 +08:00
|
|
|
elif instpage == INSTALL_PAGE_IMPORT:
|
2011-07-15 01:13:13 +08:00
|
|
|
media = self.widget("install-import-entry").get_text()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
return media
|
|
|
|
|
2009-05-11 23:00:03 +08:00
|
|
|
def get_config_url_info(self, store_media=False):
|
2013-01-13 05:13:53 +08:00
|
|
|
media = self.widget("install-url-box").get_child().get_text().strip()
|
2011-07-15 01:13:13 +08:00
|
|
|
extra = self.widget("install-urlopts-entry").get_text().strip()
|
2013-01-13 05:13:53 +08:00
|
|
|
ks = self.widget("install-ks-box").get_child().get_text().strip()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2009-05-11 23:00:03 +08:00
|
|
|
if media and store_media:
|
2009-03-10 04:16:45 +08:00
|
|
|
self.config.add_media_url(media)
|
2009-05-11 23:00:03 +08:00
|
|
|
if ks and store_media:
|
2009-03-10 04:16:45 +08:00
|
|
|
self.config.add_kickstart_url(ks)
|
|
|
|
|
|
|
|
return (media.strip(), extra.strip(), ks.strip())
|
|
|
|
|
2010-03-23 06:15:18 +08:00
|
|
|
def get_config_import_path(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
return self.widget("install-import-entry").get_text()
|
2010-03-23 06:15:18 +08:00
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
def get_config_container_app_path(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
return self.widget("install-app-entry").get_text()
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2011-06-21 23:04:22 +08:00
|
|
|
def get_config_container_fs_path(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
return self.widget("install-oscontainer-fs").get_text()
|
2011-06-21 23:04:22 +08:00
|
|
|
|
2010-03-05 04:31:33 +08:00
|
|
|
def get_default_path(self, name):
|
|
|
|
# Don't generate a new path if the install failed
|
|
|
|
if self.failed_guest:
|
2013-04-12 21:39:34 +08:00
|
|
|
disks = self.failed_guest.get_devices("disk")
|
|
|
|
if disks:
|
|
|
|
return disks[0].path
|
2010-03-05 04:31:33 +08:00
|
|
|
|
2013-08-09 21:23:01 +08:00
|
|
|
return uihelpers.get_default_path(self.conn, name)
|
2010-03-05 04:31:33 +08:00
|
|
|
|
2010-03-04 07:16:08 +08:00
|
|
|
def is_default_storage(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
usedef = self.widget("config-storage-create").get_active()
|
2010-12-04 02:09:29 +08:00
|
|
|
isimport = (self.get_config_install_page() == INSTALL_PAGE_IMPORT)
|
|
|
|
return usedef and not isimport
|
2010-03-04 07:16:08 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def get_storage_info(self):
|
|
|
|
path = None
|
2011-07-20 02:02:39 +08:00
|
|
|
size = uihelpers.spin_get_helper(self.widget("config-storage-size"))
|
2011-07-15 01:13:13 +08:00
|
|
|
sparse = not self.widget("config-storage-nosparse").get_active()
|
2010-03-23 06:15:18 +08:00
|
|
|
|
|
|
|
if self.get_config_install_page() == INSTALL_PAGE_IMPORT:
|
|
|
|
path = self.get_config_import_path()
|
|
|
|
size = None
|
|
|
|
sparse = False
|
|
|
|
|
|
|
|
elif self.is_default_storage():
|
2009-03-10 04:16:45 +08:00
|
|
|
path = self.get_default_path(self.guest.name)
|
2012-01-17 11:04:40 +08:00
|
|
|
logging.debug("Default storage path is: %s", path)
|
2009-03-10 04:16:45 +08:00
|
|
|
else:
|
2011-07-15 01:13:13 +08:00
|
|
|
path = self.widget("config-storage-entry").get_text()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2009-06-17 03:31:18 +08:00
|
|
|
return (path, size, sparse)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def get_config_network_info(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
net_list = self.widget("config-netdev")
|
|
|
|
bridge_ent = self.widget("config-netdev-bridge")
|
|
|
|
macaddr = self.widget("config-macaddr").get_text()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2010-03-21 06:35:47 +08:00
|
|
|
net_type, net_src = uihelpers.get_network_selection(net_list,
|
|
|
|
bridge_ent)
|
|
|
|
|
|
|
|
return net_type, net_src, macaddr.strip()
|
2007-02-20 00:52:37 +08:00
|
|
|
|
2010-02-08 01:18:28 +08:00
|
|
|
def get_config_customize(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
return self.widget("summary-customize").get_active()
|
2009-03-10 04:16:45 +08:00
|
|
|
def is_detect_active(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
return self.widget("install-detect-os").get_active()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
# Listeners
|
|
|
|
def conn_changed(self, src):
|
|
|
|
idx = src.get_active()
|
|
|
|
model = src.get_model()
|
|
|
|
|
|
|
|
if idx < 0:
|
2010-02-11 09:26:40 +08:00
|
|
|
conn = None
|
|
|
|
else:
|
|
|
|
uri = model[idx][0]
|
2011-07-23 04:43:26 +08:00
|
|
|
conn = self.engine.conns[uri]["conn"]
|
2010-02-11 09:26:40 +08:00
|
|
|
|
|
|
|
# If we aren't visible, let reset_state handle this for us, which
|
|
|
|
# has a better chance of reporting error
|
|
|
|
if not self.is_visible():
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
self.set_conn(conn)
|
|
|
|
|
2011-06-22 01:04:46 +08:00
|
|
|
def method_changed(self, src):
|
|
|
|
ignore = src
|
|
|
|
self.set_page_num_text(0)
|
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
def machine_changed(self, ignore):
|
|
|
|
machine = self.get_config_machine()
|
|
|
|
show_dtb_virtio = (self.capsguest.arch == "armv7l" and
|
|
|
|
machine in ["vexpress-a9", "vexpress-15"])
|
|
|
|
uihelpers.set_grid_row_visible(
|
|
|
|
self.widget("config-dtb-warn-virtio"), show_dtb_virtio)
|
|
|
|
|
2010-12-05 01:28:44 +08:00
|
|
|
def netdev_changed(self, ignore):
|
|
|
|
self.check_network_selection()
|
|
|
|
|
|
|
|
def check_network_selection(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
src = self.widget("config-netdev")
|
2010-12-05 01:28:44 +08:00
|
|
|
idx = src.get_active()
|
|
|
|
show_pxe_warn = True
|
2011-03-25 01:58:44 +08:00
|
|
|
pxe_install = (self.get_config_install_page() == INSTALL_PAGE_PXE)
|
2010-12-05 01:28:44 +08:00
|
|
|
|
|
|
|
if not idx < 0:
|
|
|
|
row = src.get_model()[idx]
|
|
|
|
ntype = row[0]
|
2011-04-12 07:42:17 +08:00
|
|
|
key = row[6]
|
2010-12-05 01:28:44 +08:00
|
|
|
|
2012-11-08 21:15:02 +08:00
|
|
|
if (ntype is None or
|
2011-04-16 03:34:24 +08:00
|
|
|
ntype == virtinst.VirtualNetworkInterface.TYPE_USER):
|
2011-04-12 07:42:17 +08:00
|
|
|
show_pxe_warn = True
|
|
|
|
elif ntype != virtinst.VirtualNetworkInterface.TYPE_VIRTUAL:
|
|
|
|
show_pxe_warn = False
|
|
|
|
else:
|
|
|
|
obj = self.conn.get_net(key)
|
|
|
|
show_pxe_warn = not obj.can_pxe()
|
2010-12-05 01:28:44 +08:00
|
|
|
|
2011-04-16 03:34:24 +08:00
|
|
|
if not (show_pxe_warn and pxe_install):
|
|
|
|
return
|
|
|
|
|
|
|
|
self.set_net_warn(True,
|
2010-12-05 01:28:44 +08:00
|
|
|
_("Network selection does not support PXE"), False)
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def hv_changed(self, src):
|
|
|
|
idx = src.get_active()
|
|
|
|
if idx < 0:
|
|
|
|
return
|
|
|
|
|
|
|
|
row = src.get_model()[idx]
|
|
|
|
|
2013-10-02 05:27:58 +08:00
|
|
|
self.change_caps(row[1])
|
2009-03-10 04:16:45 +08:00
|
|
|
self.populate_arch()
|
|
|
|
|
|
|
|
def arch_changed(self, src):
|
|
|
|
idx = src.get_active()
|
|
|
|
if idx < 0:
|
|
|
|
return
|
|
|
|
|
2009-05-12 01:18:14 +08:00
|
|
|
arch = src.get_model()[idx][0]
|
2013-10-02 05:27:58 +08:00
|
|
|
self.change_caps(self.capsguest.os_type, arch)
|
2009-05-12 01:18:14 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def url_box_changed(self, ignore):
|
|
|
|
# If the url_entry has focus, don't fire detect_media_os, it means
|
|
|
|
# the user is probably typing
|
2010-12-04 01:55:56 +08:00
|
|
|
self.mediaDetected = False
|
2013-01-17 07:31:22 +08:00
|
|
|
if self.widget("install-url-box").get_child().has_focus():
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
|
|
|
self.detect_media_os()
|
|
|
|
|
2010-12-04 01:55:56 +08:00
|
|
|
def should_detect_media(self):
|
|
|
|
return (self.is_detect_active() and not self.mediaDetected)
|
|
|
|
|
|
|
|
def detect_media_os(self, ignore1=None, forward=False):
|
|
|
|
if not self.should_detect_media():
|
|
|
|
return
|
2010-12-05 02:22:04 +08:00
|
|
|
if not self.is_install_page():
|
|
|
|
return
|
2012-02-10 19:58:45 +08:00
|
|
|
self.start_detection(forward=forward)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def toggle_detect_os(self, src):
|
|
|
|
dodetect = src.get_active()
|
|
|
|
|
2013-10-05 22:29:16 +08:00
|
|
|
self.widget("install-os-type-label").set_visible(dodetect)
|
|
|
|
self.widget("install-os-version-label").set_visible(dodetect)
|
|
|
|
self.widget("install-os-type").set_visible(not dodetect)
|
|
|
|
self.widget("install-os-version").set_visible(not dodetect)
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
if dodetect:
|
2010-12-05 02:22:04 +08:00
|
|
|
self.mediaDetected = False
|
2013-10-05 22:29:16 +08:00
|
|
|
self.detect_media_os()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
def _selected_os_row(self):
|
|
|
|
box = self.widget("install-os-type")
|
2009-03-10 04:16:45 +08:00
|
|
|
model = box.get_model()
|
2011-07-26 06:53:09 +08:00
|
|
|
idx = box.get_active()
|
|
|
|
if idx == -1:
|
|
|
|
return None
|
|
|
|
|
|
|
|
return model[idx]
|
|
|
|
|
|
|
|
def change_os_type(self, box):
|
|
|
|
ignore = box
|
|
|
|
row = self._selected_os_row()
|
|
|
|
if row:
|
|
|
|
_type = row[0]
|
2012-02-14 07:35:56 +08:00
|
|
|
self.populate_os_variant_model(_type)
|
|
|
|
if row[3]:
|
2011-07-26 06:53:09 +08:00
|
|
|
self.show_all_os = True
|
|
|
|
self.populate_os_type_model()
|
|
|
|
return
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
variant = self.widget("install-os-version")
|
2009-03-10 04:16:45 +08:00
|
|
|
variant.set_active(0)
|
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
def change_os_version(self, box):
|
|
|
|
model = box.get_model()
|
|
|
|
idx = box.get_active()
|
|
|
|
if idx == -1:
|
|
|
|
return
|
|
|
|
|
|
|
|
# Get previous
|
|
|
|
os_type_list = self.widget("install-os-type")
|
|
|
|
os_type_model = os_type_list.get_model()
|
|
|
|
type_row = self._selected_os_row()
|
|
|
|
if not type_row:
|
|
|
|
return
|
|
|
|
os_type = type_row[0]
|
|
|
|
|
|
|
|
show_all = model[idx][3]
|
|
|
|
if not show_all:
|
|
|
|
return
|
|
|
|
|
|
|
|
self.show_all_os = True
|
|
|
|
self.populate_os_type_model()
|
|
|
|
|
|
|
|
for idx in range(len(os_type_model)):
|
|
|
|
if os_type_model[idx][0] == os_type:
|
|
|
|
os_type_list.set_active(idx)
|
|
|
|
break
|
|
|
|
|
2009-11-16 05:36:37 +08:00
|
|
|
def toggle_local_cdrom(self, src):
|
2011-07-15 01:13:13 +08:00
|
|
|
combo = self.widget("install-local-cdrom-combo")
|
2009-03-10 04:16:45 +08:00
|
|
|
is_active = src.get_active()
|
|
|
|
if is_active:
|
|
|
|
if combo.get_active() != -1:
|
|
|
|
# Local CDROM was selected with media preset, detect distro
|
|
|
|
self.detect_media_os()
|
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-local-cdrom-combo").set_sensitive(is_active)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def toggle_local_iso(self, src):
|
|
|
|
uselocal = src.get_active()
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-local-box").set_sensitive(uselocal)
|
|
|
|
self.widget("install-local-browse").set_sensitive(uselocal)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def detect_visibility_changed(self, src, ignore=None):
|
2013-09-09 23:02:34 +08:00
|
|
|
is_visible = src.get_visible()
|
2011-07-15 01:13:13 +08:00
|
|
|
detect_chkbox = self.widget("install-detect-os")
|
|
|
|
nodetect_label = self.widget("install-nodetect-label")
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
detect_chkbox.set_active(is_visible)
|
|
|
|
detect_chkbox.toggled()
|
|
|
|
|
|
|
|
if is_visible:
|
|
|
|
nodetect_label.hide()
|
|
|
|
else:
|
|
|
|
nodetect_label.show()
|
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
def browse_oscontainer(self, ignore):
|
|
|
|
self._browse_file("install-oscontainer-fs", is_dir=True)
|
|
|
|
def browse_app(self, ignore):
|
|
|
|
self._browse_file("install-app-entry")
|
|
|
|
def browse_import(self, ignore):
|
|
|
|
self._browse_file("install-import-entry")
|
|
|
|
def browse_iso(self, ignore):
|
2011-06-21 23:04:22 +08:00
|
|
|
def set_path(ignore, path):
|
2012-05-14 21:24:56 +08:00
|
|
|
self.widget("install-local-box").get_child().set_text(path)
|
2013-10-02 23:56:51 +08:00
|
|
|
self._browse_file(None, cb=set_path, is_media=True)
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-local-box").activate()
|
2013-10-02 23:56:51 +08:00
|
|
|
def browse_storage(self, ignore):
|
|
|
|
self._browse_file("config-storage-entry")
|
|
|
|
def browse_kernel(self, ignore):
|
|
|
|
self._browse_file("config-kernel")
|
|
|
|
def browse_initrd(self, ignore):
|
|
|
|
self._browse_file("config-initrd")
|
|
|
|
def browse_dtb(self, ignore):
|
|
|
|
self._browse_file("config-dtb")
|
2011-06-21 23:04:22 +08:00
|
|
|
|
|
|
|
def toggle_enable_storage(self, src):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-storage-box").set_sensitive(src.get_active())
|
2010-03-23 06:15:18 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def toggle_storage_select(self, src):
|
|
|
|
act = src.get_active()
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-storage-browse-box").set_sensitive(act)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def toggle_macaddr(self, src):
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("config-macaddr").set_sensitive(src.get_active())
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Navigation methods
|
|
|
|
def set_install_page(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
instnotebook = self.widget("install-method-pages")
|
|
|
|
detectbox = self.widget("install-detect-os-box")
|
|
|
|
osbox = self.widget("install-os-distro-box")
|
2009-03-10 04:16:45 +08:00
|
|
|
instpage = self.get_config_install_page()
|
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
# Setting OS value for a container guest doesn't really matter
|
|
|
|
# at the moment
|
|
|
|
iscontainer = instpage in [INSTALL_PAGE_CONTAINER_APP,
|
|
|
|
INSTALL_PAGE_CONTAINER_OS]
|
2013-09-02 08:18:14 +08:00
|
|
|
osbox.set_visible(iscontainer)
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Detection only works/ is valid for URL,
|
|
|
|
# FIXME: Also works for CDROM if running as root (since we need to
|
|
|
|
# mount the iso/cdrom), but we should probably make this work for
|
|
|
|
# more distros (like windows) before we enable it
|
|
|
|
if (instpage == INSTALL_PAGE_URL):
|
|
|
|
detectbox.show()
|
|
|
|
else:
|
|
|
|
detectbox.hide()
|
|
|
|
|
|
|
|
if instpage == INSTALL_PAGE_PXE:
|
|
|
|
# Hide the install notebook for pxe, since there isn't anything
|
|
|
|
# to ask for
|
|
|
|
instnotebook.hide()
|
|
|
|
else:
|
|
|
|
instnotebook.show()
|
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
instnotebook.set_current_page(instpage)
|
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
def container_install(self):
|
|
|
|
return self.get_config_install_page() in [INSTALL_PAGE_CONTAINER_APP,
|
|
|
|
INSTALL_PAGE_CONTAINER_OS]
|
|
|
|
def skip_disk_page(self):
|
|
|
|
return self.get_config_install_page() in [INSTALL_PAGE_IMPORT,
|
|
|
|
INSTALL_PAGE_CONTAINER_APP,
|
|
|
|
INSTALL_PAGE_CONTAINER_OS]
|
|
|
|
|
2010-12-10 00:22:35 +08:00
|
|
|
def back(self, src_ignore):
|
2011-07-15 01:13:13 +08:00
|
|
|
notebook = self.widget("create-pages")
|
2009-03-10 04:16:45 +08:00
|
|
|
curpage = notebook.get_current_page()
|
2010-06-02 22:07:34 +08:00
|
|
|
next_page = curpage - 1
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
if curpage == PAGE_FINISH and self.skip_disk_page():
|
2010-06-02 22:07:34 +08:00
|
|
|
# Skip over storage page
|
|
|
|
next_page -= 1
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2010-06-02 22:07:34 +08:00
|
|
|
notebook.set_current_page(next_page)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-07-19 09:31:06 +08:00
|
|
|
def _get_next_pagenum(self, curpage):
|
|
|
|
next_page = curpage + 1
|
|
|
|
|
|
|
|
if next_page == PAGE_STORAGE and self.skip_disk_page():
|
|
|
|
# Skip storage page for import installs
|
|
|
|
next_page += 1
|
|
|
|
|
|
|
|
return next_page
|
|
|
|
|
2010-12-10 00:22:35 +08:00
|
|
|
def forward(self, src_ignore=None):
|
2011-07-15 01:13:13 +08:00
|
|
|
notebook = self.widget("create-pages")
|
2009-03-10 04:16:45 +08:00
|
|
|
curpage = notebook.get_current_page()
|
|
|
|
|
2011-03-16 04:33:55 +08:00
|
|
|
if self.have_startup_error:
|
|
|
|
return
|
|
|
|
|
2010-12-04 01:55:56 +08:00
|
|
|
if curpage == PAGE_INSTALL and self.should_detect_media():
|
|
|
|
# Make sure we have detected the OS before validating the page
|
|
|
|
self.detect_media_os(forward=True)
|
|
|
|
return
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
if self.validate(curpage) is not True:
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
if curpage == PAGE_NAME:
|
|
|
|
self.set_install_page()
|
|
|
|
|
2011-07-19 09:31:06 +08:00
|
|
|
next_page = self._get_next_pagenum(curpage)
|
2010-03-23 06:15:18 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("create-forward").grab_focus()
|
2010-03-23 06:15:18 +08:00
|
|
|
notebook.set_current_page(next_page)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-06-22 01:04:46 +08:00
|
|
|
def set_page_num_text(self, cur):
|
|
|
|
cur += 1
|
|
|
|
final = PAGE_FINISH + 1
|
|
|
|
if self.skip_disk_page():
|
|
|
|
final -= 1
|
|
|
|
cur = min(cur, final)
|
2006-09-13 05:49:29 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
page_lbl = ("<span color='#59B0E2'>%s</span>" %
|
|
|
|
_("Step %(current_page)d of %(max_page)d") %
|
2011-06-22 01:04:46 +08:00
|
|
|
{'current_page': cur, 'max_page': final})
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-09-27 22:26:43 +08:00
|
|
|
self.widget("header-pagenum").set_markup(page_lbl)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-06-22 01:04:46 +08:00
|
|
|
def page_changed(self, ignore1, ignore2, pagenum):
|
|
|
|
# Update page number
|
|
|
|
self.set_page_num_text(pagenum)
|
|
|
|
|
2013-10-03 00:12:26 +08:00
|
|
|
self.widget("create-back").set_sensitive(pagenum != PAGE_NAME)
|
|
|
|
self.widget("create-forward").set_visible(pagenum != PAGE_FINISH)
|
|
|
|
self.widget("create-finish").set_visible(pagenum == PAGE_FINISH)
|
2008-09-05 21:42:25 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
if pagenum == PAGE_INSTALL:
|
|
|
|
self.detect_media_os()
|
2013-10-03 00:12:26 +08:00
|
|
|
self.widget("install-os-distro-box").set_visible(
|
|
|
|
not self.container_install())
|
|
|
|
elif pagenum == PAGE_FINISH:
|
|
|
|
self.widget("create-finish").grab_focus()
|
|
|
|
self.populate_summary()
|
|
|
|
self.widget("config-netdev").emit("changed")
|
|
|
|
|
|
|
|
for nr in range(self.widget("create-pages").get_n_pages()):
|
|
|
|
page = self.widget("create-pages").get_nth_page(nr)
|
|
|
|
page.set_visible(nr == pagenum)
|
2010-12-05 01:28:44 +08:00
|
|
|
|
2011-06-09 05:20:26 +08:00
|
|
|
def get_graphics_device(self, guest):
|
2013-07-17 19:53:47 +08:00
|
|
|
if guest.os.is_container():
|
2011-06-09 05:20:26 +08:00
|
|
|
return
|
2013-10-03 01:30:18 +08:00
|
|
|
if guest.os.arch not in ["x86_64", "i686", "ppc64"]:
|
|
|
|
return
|
2011-06-09 05:20:26 +08:00
|
|
|
|
2013-10-03 06:06:52 +08:00
|
|
|
guest.default_graphics_type = self.config.get_graphics_type()
|
|
|
|
return virtinst.VirtualGraphics(guest.conn)
|
2011-06-09 05:20:26 +08:00
|
|
|
|
2013-11-10 07:33:49 +08:00
|
|
|
def build_guest(self, variant):
|
2013-10-02 23:56:51 +08:00
|
|
|
guest = self.conn.caps.build_virtinst_guest(
|
|
|
|
self.conn.get_backend(), self.capsguest, self.capsdomain)
|
|
|
|
guest.os.machine = self.get_config_machine()
|
2010-02-06 06:58:26 +08:00
|
|
|
|
2011-07-08 02:39:28 +08:00
|
|
|
# Generate UUID (makes customize dialog happy)
|
|
|
|
try:
|
2013-08-09 21:23:01 +08:00
|
|
|
guest.uuid = util.randomUUID(guest.conn)
|
2011-07-08 02:39:28 +08:00
|
|
|
except Exception, e:
|
|
|
|
self.err.show_err(_("Error setting UUID: %s") % str(e))
|
|
|
|
return None
|
|
|
|
|
2013-11-10 07:33:49 +08:00
|
|
|
# OS distro/variant validation
|
|
|
|
try:
|
|
|
|
if variant:
|
|
|
|
guest.os_variant = variant
|
|
|
|
except ValueError, e:
|
|
|
|
self.err.show_err(_("Error setting OS information."), e)
|
|
|
|
return None
|
|
|
|
|
2011-06-09 05:20:26 +08:00
|
|
|
# Set up default devices
|
2010-02-06 06:58:26 +08:00
|
|
|
try:
|
2013-08-18 20:59:19 +08:00
|
|
|
gdev = self.get_graphics_device(guest)
|
|
|
|
if gdev:
|
|
|
|
guest.add_device(gdev)
|
2011-03-24 21:42:34 +08:00
|
|
|
|
2013-10-06 20:30:33 +08:00
|
|
|
guest.add_default_video_device()
|
2013-07-17 03:59:27 +08:00
|
|
|
guest.add_default_input_device()
|
|
|
|
guest.add_default_console_device()
|
2013-10-03 03:51:01 +08:00
|
|
|
guest.add_default_usb_controller()
|
2013-10-06 21:19:59 +08:00
|
|
|
guest.add_default_channels()
|
2014-01-18 04:32:40 +08:00
|
|
|
|
|
|
|
if self.config.get_new_vm_sound():
|
|
|
|
guest.add_default_sound_device()
|
|
|
|
|
|
|
|
if (guest.conn.is_qemu() and
|
|
|
|
guest.type == "kvm" and
|
|
|
|
guest.os.is_x86() and
|
|
|
|
guest.os.arch == guest.conn.caps.host.cpu.arch):
|
|
|
|
cpu_type = self.config.get_default_cpu_setting()
|
|
|
|
|
|
|
|
if cpu_type == "hv-default":
|
|
|
|
pass
|
|
|
|
elif cpu_type == "host-cpu-model":
|
|
|
|
if guest.conn.caps.host.cpu.model:
|
|
|
|
guest.cpu.model = guest.conn.caps.host.cpu.model
|
|
|
|
elif cpu_type == "host-model":
|
|
|
|
# host-model has known issues, so use our 'copy cpu'
|
|
|
|
# behavior until host-model does what we need
|
|
|
|
guest.cpu.copy_host_cpu()
|
|
|
|
else:
|
|
|
|
raise RuntimeError("Unknown cpu default '%s'" % cpu_type)
|
|
|
|
|
2010-02-06 06:58:26 +08:00
|
|
|
except Exception, e:
|
2011-06-09 05:20:26 +08:00
|
|
|
self.err.show_err(_("Error setting up default devices:") + str(e))
|
2010-02-06 06:58:26 +08:00
|
|
|
return None
|
|
|
|
|
|
|
|
return guest
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
def validate(self, pagenum):
|
2009-03-10 04:16:45 +08:00
|
|
|
try:
|
|
|
|
if pagenum == PAGE_NAME:
|
|
|
|
return self.validate_name_page()
|
|
|
|
elif pagenum == PAGE_INSTALL:
|
2013-10-02 03:18:34 +08:00
|
|
|
return self.validate_install_page()
|
2009-03-10 04:16:45 +08:00
|
|
|
elif pagenum == PAGE_MEM:
|
|
|
|
return self.validate_mem_page()
|
|
|
|
elif pagenum == PAGE_STORAGE:
|
2013-10-02 03:18:34 +08:00
|
|
|
return self.validate_storage_page()
|
2009-03-10 04:16:45 +08:00
|
|
|
elif pagenum == PAGE_FINISH:
|
|
|
|
return self.validate_final_page()
|
|
|
|
except Exception, e:
|
|
|
|
self.err.show_err(_("Uncaught error validating install "
|
2011-04-06 23:22:03 +08:00
|
|
|
"parameters: %s") % str(e))
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
|
|
|
|
|
|
|
def validate_name_page(self):
|
2013-10-02 23:56:51 +08:00
|
|
|
# We just set this here because it's needed soon after for distro
|
|
|
|
# detction. But the 'real' self.guest is created in validate_install,
|
|
|
|
# and it just uses build_guest, so don't ever add any other guest
|
|
|
|
# altering here.
|
2013-11-10 07:33:49 +08:00
|
|
|
self.guest = self.build_guest(None)
|
2013-10-02 23:56:51 +08:00
|
|
|
if not self.guest:
|
|
|
|
return False
|
2013-10-02 03:18:34 +08:00
|
|
|
return True
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
def _generate_default_name(self, distro, variant):
|
|
|
|
force_num = False
|
|
|
|
if self.guest.os.is_container():
|
|
|
|
basename = "container"
|
|
|
|
force_num = True
|
|
|
|
elif not distro:
|
|
|
|
basename = "vm"
|
|
|
|
force_num = True
|
|
|
|
elif not variant:
|
|
|
|
basename = distro
|
|
|
|
else:
|
|
|
|
basename = variant
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2014-01-19 02:23:30 +08:00
|
|
|
if self.guest.os.arch != self.conn.caps.host.cpu.arch:
|
2013-10-03 01:19:40 +08:00
|
|
|
basename += "-%s" % pretty_arch(self.guest.os.arch)
|
|
|
|
force_num = False
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
return util.generate_name(basename,
|
|
|
|
self.conn.get_backend().lookupByName,
|
|
|
|
start_num=force_num and 1 or 2, force_num=force_num,
|
|
|
|
sep=not force_num and "-" or "",
|
|
|
|
collidelist=[vm.get_name() for vm in self.conn.vms.values()])
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
def validate_install_page(self):
|
2009-03-10 04:16:45 +08:00
|
|
|
instmethod = self.get_config_install_page()
|
|
|
|
installer = None
|
|
|
|
location = None
|
|
|
|
extra = None
|
|
|
|
ks = None
|
|
|
|
cdrom = False
|
2010-03-23 06:15:18 +08:00
|
|
|
is_import = False
|
2011-06-08 05:42:50 +08:00
|
|
|
init = None
|
2011-06-21 23:04:22 +08:00
|
|
|
fs = None
|
2009-03-10 04:16:45 +08:00
|
|
|
distro, variant, ignore1, ignore2 = self.get_config_os_info()
|
|
|
|
|
|
|
|
if instmethod == INSTALL_PAGE_ISO:
|
2010-12-08 05:17:19 +08:00
|
|
|
instclass = virtinst.DistroInstaller
|
2009-03-10 04:16:45 +08:00
|
|
|
media = self.get_config_local_media()
|
|
|
|
|
|
|
|
if not media:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(
|
|
|
|
_("An install media selection is required."))
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
location = media
|
|
|
|
cdrom = True
|
|
|
|
|
|
|
|
elif instmethod == INSTALL_PAGE_URL:
|
|
|
|
instclass = virtinst.DistroInstaller
|
|
|
|
media, extra, ks = self.get_config_url_info()
|
|
|
|
|
|
|
|
if not media:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("An install tree is required."))
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
location = media
|
|
|
|
|
|
|
|
elif instmethod == INSTALL_PAGE_PXE:
|
|
|
|
instclass = virtinst.PXEInstaller
|
|
|
|
|
2010-03-23 06:15:18 +08:00
|
|
|
elif instmethod == INSTALL_PAGE_IMPORT:
|
|
|
|
instclass = virtinst.ImportInstaller
|
|
|
|
is_import = True
|
|
|
|
|
|
|
|
import_path = self.get_config_import_path()
|
|
|
|
if not import_path:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(
|
|
|
|
_("A storage path to import is required."))
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2011-06-08 05:42:50 +08:00
|
|
|
elif instmethod == INSTALL_PAGE_CONTAINER_APP:
|
|
|
|
instclass = virtinst.ContainerInstaller
|
|
|
|
|
|
|
|
init = self.get_config_container_app_path()
|
|
|
|
if not init:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("An application path is required."))
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2011-06-21 23:04:22 +08:00
|
|
|
elif instmethod == INSTALL_PAGE_CONTAINER_OS:
|
|
|
|
instclass = virtinst.ContainerInstaller
|
|
|
|
|
|
|
|
fs = self.get_config_container_fs_path()
|
|
|
|
if not fs:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("An OS directory path is required."))
|
2011-06-21 23:04:22 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Build the installer and Guest instance
|
|
|
|
try:
|
2013-10-02 23:56:51 +08:00
|
|
|
# Overwrite the guest
|
2013-07-17 19:53:47 +08:00
|
|
|
installer = instclass(self.conn.get_backend())
|
2013-11-10 07:33:49 +08:00
|
|
|
self.guest = self.build_guest(variant or distro)
|
2010-02-06 06:58:26 +08:00
|
|
|
if not self.guest:
|
|
|
|
return False
|
2013-10-02 23:56:51 +08:00
|
|
|
self.guest.installer = installer
|
2009-03-10 04:16:45 +08:00
|
|
|
except Exception, e:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(
|
|
|
|
_("Error setting installer parameters."), e)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Validate media location
|
|
|
|
try:
|
|
|
|
if location is not None:
|
|
|
|
self.guest.installer.location = location
|
|
|
|
if cdrom:
|
|
|
|
self.guest.installer.cdrom = True
|
|
|
|
|
|
|
|
extraargs = ""
|
|
|
|
if extra:
|
|
|
|
extraargs += extra
|
|
|
|
if ks:
|
|
|
|
extraargs += " ks=%s" % ks
|
|
|
|
|
|
|
|
if extraargs:
|
|
|
|
self.guest.installer.extraargs = extraargs
|
2011-06-08 05:42:50 +08:00
|
|
|
|
|
|
|
if init:
|
2013-07-17 19:53:47 +08:00
|
|
|
self.guest.os.init = init
|
2011-06-08 05:42:50 +08:00
|
|
|
|
2011-06-21 23:04:22 +08:00
|
|
|
if fs:
|
2013-07-06 08:14:57 +08:00
|
|
|
fsdev = virtinst.VirtualFilesystem(self.guest.conn)
|
2011-06-21 23:04:22 +08:00
|
|
|
fsdev.target = "/"
|
|
|
|
fsdev.source = fs
|
|
|
|
self.guest.add_device(fsdev)
|
2009-03-10 04:16:45 +08:00
|
|
|
except Exception, e:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(
|
|
|
|
_("Error setting install media location."), e)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
# Setting kernel
|
|
|
|
if instmethod == INSTALL_PAGE_IMPORT:
|
|
|
|
kernel = self.widget("config-kernel").get_text() or None
|
|
|
|
kargs = self.widget("config-kernel-args").get_text() or None
|
|
|
|
initrd = self.widget("config-initrd").get_text() or None
|
|
|
|
dtb = self.widget("config-dtb").get_text() or None
|
|
|
|
|
|
|
|
if not self.widget("config-dtb").get_visible():
|
|
|
|
dtb = None
|
|
|
|
if not self.widget("config-kernel").get_visible():
|
|
|
|
kernel = None
|
|
|
|
initrd = None
|
|
|
|
kargs = None
|
|
|
|
|
|
|
|
self.guest.os.kernel = kernel
|
|
|
|
self.guest.os.initrd = initrd
|
|
|
|
self.guest.os.dtb = dtb
|
|
|
|
self.guest.os.kernel_args = kargs
|
|
|
|
|
|
|
|
require_kernel = ("arm" in self.capsguest.arch)
|
|
|
|
if require_kernel and not kernel:
|
|
|
|
return self.err.val_err(
|
|
|
|
_("A kernel is required for %s guests.") %
|
|
|
|
self.capsguest.arch)
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
try:
|
|
|
|
name = self._generate_default_name(distro, variant)
|
|
|
|
self.widget("create-vm-name").set_text(name)
|
|
|
|
self.guest.name = name
|
|
|
|
except Exception, e:
|
|
|
|
return self.err.val_err(_("Error setting default name."), e)
|
|
|
|
|
2010-03-23 06:15:18 +08:00
|
|
|
# Kind of wonky, run storage validation now, which will assign
|
|
|
|
# the import path. Import installer skips the storage page.
|
|
|
|
if is_import:
|
2013-10-02 03:18:34 +08:00
|
|
|
if not self.validate_storage_page():
|
2010-03-23 06:15:18 +08:00
|
|
|
return False
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
if self.guest.installer.scratchdir_required():
|
|
|
|
path = util.make_scratchdir(self.guest.conn, self.guest.type)
|
|
|
|
elif instmethod == INSTALL_PAGE_ISO:
|
|
|
|
path = self.guest.installer.location
|
|
|
|
else:
|
|
|
|
path = None
|
2009-12-02 01:41:45 +08:00
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
if path:
|
|
|
|
uihelpers.check_path_search_for_qemu(self.err, self.conn, path)
|
2009-12-02 01:41:45 +08:00
|
|
|
|
2009-05-11 23:00:03 +08:00
|
|
|
# Validation passed, store the install path (if there is one) in
|
|
|
|
# gconf
|
|
|
|
self.get_config_local_media(store_media=True)
|
|
|
|
self.get_config_url_info(store_media=True)
|
2009-03-10 04:16:45 +08:00
|
|
|
return True
|
2007-02-02 03:16:44 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def validate_mem_page(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
cpus = self.widget("config-cpus").get_value()
|
|
|
|
mem = self.widget("config-mem").get_value()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# VCPUS
|
|
|
|
try:
|
|
|
|
self.guest.vcpus = int(cpus)
|
|
|
|
except Exception, e:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("Error setting CPUs."), e)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Memory
|
|
|
|
try:
|
2013-07-14 11:07:01 +08:00
|
|
|
self.guest.memory = int(mem) * 1024
|
|
|
|
self.guest.maxmemory = int(mem) * 1024
|
2009-03-10 04:16:45 +08:00
|
|
|
except Exception, e:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("Error setting guest memory."), e)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
return True
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
def validate_storage_page(self):
|
2011-07-15 01:13:13 +08:00
|
|
|
use_storage = self.widget("enable-storage").get_active()
|
2010-12-08 05:17:19 +08:00
|
|
|
instcd = self.get_config_install_page() == INSTALL_PAGE_ISO
|
2013-07-05 20:59:58 +08:00
|
|
|
conn = self.conn.get_backend()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2010-12-08 05:17:19 +08:00
|
|
|
# CD/ISO install and no disks implies LiveCD
|
|
|
|
if instcd:
|
|
|
|
self.guest.installer.livecd = not use_storage
|
|
|
|
|
2010-12-08 05:48:13 +08:00
|
|
|
if self.disk and self.disk in self.guest.get_devices("disk"):
|
|
|
|
self.guest.remove_device(self.disk)
|
|
|
|
self.disk = None
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
# Validate storage
|
|
|
|
if not use_storage:
|
|
|
|
return True
|
|
|
|
|
2010-05-13 22:37:46 +08:00
|
|
|
# Make sure default pool is running
|
|
|
|
if self.is_default_storage():
|
2013-07-09 21:12:26 +08:00
|
|
|
ret = uihelpers.check_default_pool_active(self.err, self.conn)
|
2010-05-13 22:37:46 +08:00
|
|
|
if not ret:
|
|
|
|
return False
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
try:
|
|
|
|
# This can error out
|
|
|
|
diskpath, disksize, sparse = self.get_storage_info()
|
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
if self.is_default_storage():
|
2010-03-04 07:16:08 +08:00
|
|
|
# See if the ideal disk path (/default/pool/vmname.img)
|
|
|
|
# exists, and if unused, prompt the use for using it
|
2013-08-09 21:23:01 +08:00
|
|
|
ideal = uihelpers.get_ideal_path(self.conn,
|
|
|
|
self.guest.name)
|
2010-03-04 07:16:08 +08:00
|
|
|
do_exist = False
|
|
|
|
ret = True
|
|
|
|
|
|
|
|
try:
|
2013-07-05 20:59:58 +08:00
|
|
|
do_exist = virtinst.VirtualDisk.path_exists(conn, ideal)
|
|
|
|
ret = virtinst.VirtualDisk.path_in_use_by(conn, ideal)
|
2010-03-04 07:16:08 +08:00
|
|
|
except:
|
|
|
|
logging.exception("Error checking default path usage")
|
|
|
|
|
|
|
|
if do_exist and not ret:
|
|
|
|
do_use = self.err.yes_no(
|
2011-03-09 00:22:01 +08:00
|
|
|
_("The following storage already exists, but is not\n"
|
2010-03-04 07:16:08 +08:00
|
|
|
"in use by any virtual machine:\n\n%s\n\n"
|
2011-03-09 00:22:01 +08:00
|
|
|
"Would you like to reuse this storage?") % ideal)
|
2010-03-04 07:16:08 +08:00
|
|
|
|
|
|
|
if do_use:
|
|
|
|
diskpath = ideal
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
if not diskpath:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("A storage path must be specified."))
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-07-13 22:09:00 +08:00
|
|
|
disk = virtinst.VirtualDisk(conn)
|
|
|
|
disk.path = diskpath
|
|
|
|
disk.set_create_storage(size=disksize, sparse=sparse)
|
2008-02-15 06:33:52 +08:00
|
|
|
|
2013-10-03 03:17:15 +08:00
|
|
|
fmt = self.conn.get_default_storage_format()
|
2012-02-14 03:49:00 +08:00
|
|
|
if (self.is_default_storage() and
|
2013-07-13 22:09:00 +08:00
|
|
|
disk.get_vol_install() and
|
2013-09-20 08:18:12 +08:00
|
|
|
fmt in disk.get_vol_install().list_formats()):
|
2012-02-14 03:49:00 +08:00
|
|
|
logging.debug("Setting disk format from prefs: %s", fmt)
|
2013-07-13 22:09:00 +08:00
|
|
|
disk.get_vol_install().format = fmt
|
|
|
|
disk.validate()
|
2012-02-14 03:49:00 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
except Exception, e:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(_("Storage parameter error."), e)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
isfatal, errmsg = disk.is_size_conflict()
|
2013-10-02 03:18:34 +08:00
|
|
|
if not isfatal and errmsg:
|
2009-03-10 04:16:45 +08:00
|
|
|
# Fatal errors are reported when setting 'size'
|
|
|
|
res = self.err.ok_cancel(_("Not Enough Free Space"), errmsg)
|
|
|
|
if not res:
|
|
|
|
return False
|
|
|
|
|
|
|
|
# Disk collision
|
2014-01-15 06:11:51 +08:00
|
|
|
names = disk.is_conflict_disk()
|
2013-10-02 03:18:34 +08:00
|
|
|
if names:
|
|
|
|
res = self.err.yes_no(
|
|
|
|
_('Disk "%s" is already in use by other guests %s') %
|
|
|
|
(disk.path, names),
|
|
|
|
_("Do you really want to use the disk?"))
|
|
|
|
if not res:
|
|
|
|
return False
|
2009-09-24 23:41:49 +08:00
|
|
|
|
2013-10-02 03:18:34 +08:00
|
|
|
uihelpers.check_path_search_for_qemu(self.err, self.conn, disk.path)
|
2009-12-02 01:35:04 +08:00
|
|
|
|
2010-12-08 05:48:13 +08:00
|
|
|
self.disk = disk
|
2013-07-26 02:11:09 +08:00
|
|
|
self.guest.add_device(self.disk)
|
2010-12-08 05:48:13 +08:00
|
|
|
|
2009-09-24 23:41:49 +08:00
|
|
|
return True
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
def validate_final_page(self):
|
2010-12-08 03:20:11 +08:00
|
|
|
# HV + Arch selection
|
2013-10-02 03:18:34 +08:00
|
|
|
name = self.get_config_name()
|
|
|
|
if name != self.guest.name:
|
|
|
|
self.guest.name = name
|
|
|
|
if self.is_default_storage():
|
|
|
|
# User changed the name and we are using default storage
|
|
|
|
# which depends on the VM name. Revalidate things
|
|
|
|
if not self.validate_storage_page():
|
|
|
|
return False
|
2010-12-08 03:20:11 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
nettype, devname, macaddr = self.get_config_network_info()
|
|
|
|
|
|
|
|
if nettype is None:
|
|
|
|
# No network device available
|
|
|
|
instmethod = self.get_config_install_page()
|
|
|
|
methname = None
|
|
|
|
if instmethod == INSTALL_PAGE_PXE:
|
|
|
|
methname = "PXE"
|
|
|
|
elif instmethod == INSTALL_PAGE_URL:
|
|
|
|
methname = "URL"
|
|
|
|
|
|
|
|
if methname:
|
2011-08-31 02:50:50 +08:00
|
|
|
return self.err.val_err(
|
|
|
|
_("Network device required for %s install.") %
|
|
|
|
methname)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2013-07-09 21:20:43 +08:00
|
|
|
nic = uihelpers.validate_network(self.err,
|
2009-11-21 02:12:24 +08:00
|
|
|
self.conn, nettype, devname, macaddr)
|
2012-11-08 21:15:02 +08:00
|
|
|
if nic is False:
|
2009-11-21 02:12:24 +08:00
|
|
|
return False
|
|
|
|
|
2010-12-08 05:48:13 +08:00
|
|
|
if self.nic and self.nic in self.guest.get_devices("interface"):
|
|
|
|
self.guest.remove_device(self.nic)
|
2011-04-08 05:11:10 +08:00
|
|
|
if nic:
|
|
|
|
self.nic = nic
|
|
|
|
self.guest.add_device(self.nic)
|
2010-01-25 23:04:31 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
return True
|
|
|
|
|
2013-09-07 08:59:01 +08:00
|
|
|
def _undo_finish_cursor(self):
|
|
|
|
self.topwin.set_sensitive(True)
|
|
|
|
self.topwin.get_window().set_cursor(
|
|
|
|
Gdk.Cursor.new(Gdk.CursorType.TOP_LEFT_ARROW))
|
|
|
|
|
2010-12-10 00:22:35 +08:00
|
|
|
def finish(self, src_ignore):
|
2010-02-06 06:58:26 +08:00
|
|
|
# Validate the final page
|
2011-07-15 01:13:13 +08:00
|
|
|
page = self.widget("create-pages").get_current_page()
|
2012-11-08 21:15:02 +08:00
|
|
|
if self.validate(page) is not True:
|
2008-09-03 00:09:39 +08:00
|
|
|
return False
|
|
|
|
|
2010-02-08 01:18:28 +08:00
|
|
|
guest = self.guest
|
2009-03-10 04:16:45 +08:00
|
|
|
|
|
|
|
# Start the install
|
2009-07-07 04:49:47 +08:00
|
|
|
self.failed_guest = None
|
2006-10-25 21:38:17 +08:00
|
|
|
self.topwin.set_sensitive(False)
|
2013-10-02 03:18:34 +08:00
|
|
|
self.topwin.get_window().set_cursor(
|
|
|
|
Gdk.Cursor.new(Gdk.CursorType.WATCH))
|
2007-01-11 05:11:57 +08:00
|
|
|
|
2013-09-07 08:59:01 +08:00
|
|
|
if self.get_config_customize():
|
|
|
|
try:
|
|
|
|
self.customize(guest)
|
|
|
|
except Exception, e:
|
|
|
|
self._undo_finish_cursor()
|
|
|
|
self.err.show_err(_("Error starting installation: ") + str(e))
|
2010-12-08 03:20:11 +08:00
|
|
|
return
|
2013-09-07 08:59:01 +08:00
|
|
|
else:
|
|
|
|
self.start_install(guest)
|
2010-02-08 01:18:28 +08:00
|
|
|
|
|
|
|
def customize(self, guest):
|
2010-12-10 01:37:48 +08:00
|
|
|
virtinst_guest = vmmDomainVirtinst(self.conn, guest, self.guest.uuid)
|
2010-02-08 01:18:28 +08:00
|
|
|
|
2011-04-15 01:22:05 +08:00
|
|
|
def cleanup_config_window():
|
|
|
|
if self.config_window:
|
2011-07-19 09:31:06 +08:00
|
|
|
for s in self.config_window_signals:
|
|
|
|
self.config_window.disconnect(s)
|
2011-04-15 01:22:05 +08:00
|
|
|
self.config_window.cleanup()
|
|
|
|
self.config_window = None
|
2010-02-08 01:18:28 +08:00
|
|
|
|
|
|
|
def start_install_wrapper(ignore, guest):
|
2011-04-15 01:22:05 +08:00
|
|
|
cleanup_config_window()
|
2010-12-08 03:20:11 +08:00
|
|
|
if not self.is_visible():
|
|
|
|
return
|
2013-09-07 08:59:01 +08:00
|
|
|
self.start_install(guest)
|
2010-12-08 03:20:11 +08:00
|
|
|
|
2011-07-19 09:31:06 +08:00
|
|
|
def details_closed(ignore):
|
2011-07-23 08:02:49 +08:00
|
|
|
cleanup_config_window()
|
2013-09-07 08:59:01 +08:00
|
|
|
self._undo_finish_cursor()
|
2011-07-19 09:31:06 +08:00
|
|
|
self.widget("summary-customize").set_active(False)
|
2010-02-08 01:18:28 +08:00
|
|
|
|
2011-04-15 01:22:05 +08:00
|
|
|
cleanup_config_window()
|
2011-07-19 09:31:06 +08:00
|
|
|
self.config_window = vmmDetails(virtinst_guest, self.topwin)
|
|
|
|
self.config_window_signals = []
|
|
|
|
self.config_window_signals.append(self.config_window.connect(
|
|
|
|
"customize-finished",
|
2010-02-08 01:18:28 +08:00
|
|
|
start_install_wrapper,
|
2011-07-19 09:31:06 +08:00
|
|
|
guest))
|
|
|
|
self.config_window_signals.append(self.config_window.connect(
|
|
|
|
"details-closed",
|
|
|
|
details_closed))
|
2010-02-08 01:18:28 +08:00
|
|
|
self.config_window.show()
|
|
|
|
|
2013-09-07 08:59:01 +08:00
|
|
|
def _install_finished_cb(self, error, details):
|
|
|
|
self._undo_finish_cursor()
|
2009-04-04 02:15:15 +08:00
|
|
|
|
|
|
|
if error:
|
2010-12-10 22:57:42 +08:00
|
|
|
error = (_("Unable to complete install: '%s'") % error)
|
2011-04-06 23:22:03 +08:00
|
|
|
self.err.show_err(error,
|
2011-04-06 23:52:26 +08:00
|
|
|
details=details)
|
2009-07-07 04:49:47 +08:00
|
|
|
self.failed_guest = self.guest
|
2009-04-04 02:15:15 +08:00
|
|
|
return
|
|
|
|
|
2011-04-16 02:43:52 +08:00
|
|
|
self.close()
|
|
|
|
|
|
|
|
# Launch details dialog for new VM
|
2013-09-23 03:13:41 +08:00
|
|
|
self.emit("action-show-domain", self.conn.get_uri(), self.guest.uuid)
|
2013-09-07 08:59:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
def start_install(self, guest):
|
|
|
|
progWin = vmmAsyncJob(self.do_install, [guest],
|
|
|
|
self._install_finished_cb, [],
|
|
|
|
_("Creating Virtual Machine"),
|
|
|
|
_("The virtual machine is now being "
|
|
|
|
"created. Allocation of disk storage "
|
|
|
|
"and retrieval of the installation "
|
|
|
|
"images may take a few minutes to "
|
|
|
|
"complete."),
|
|
|
|
self.topwin)
|
|
|
|
progWin.run()
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2010-12-10 22:57:42 +08:00
|
|
|
def do_install(self, asyncjob, guest):
|
2012-02-10 23:24:43 +08:00
|
|
|
meter = asyncjob.get_meter()
|
2008-08-19 00:02:49 +08:00
|
|
|
|
2010-12-10 22:57:42 +08:00
|
|
|
logging.debug("Starting background install process")
|
2013-08-09 23:25:05 +08:00
|
|
|
guest.start_install(meter=meter)
|
2010-12-10 22:57:42 +08:00
|
|
|
logging.debug("Install completed")
|
2010-03-01 08:40:06 +08:00
|
|
|
|
2010-12-10 22:57:42 +08:00
|
|
|
# Make sure we pick up the domain object
|
2013-07-07 08:03:42 +08:00
|
|
|
|
|
|
|
# Wait for VM to show up
|
2013-07-07 23:06:15 +08:00
|
|
|
self.conn.schedule_priority_tick(pollvm=True)
|
2013-07-07 08:03:42 +08:00
|
|
|
count = 0
|
|
|
|
while (guest.uuid not in self.conn.vms) and (count < 100):
|
|
|
|
count += 1
|
|
|
|
time.sleep(.1)
|
|
|
|
|
2010-12-10 22:57:42 +08:00
|
|
|
vm = self.conn.get_vm(guest.uuid)
|
2011-07-24 03:51:19 +08:00
|
|
|
vm.tick()
|
2007-04-11 06:50:04 +08:00
|
|
|
|
2010-12-10 22:57:42 +08:00
|
|
|
if vm.is_shutoff():
|
|
|
|
# Domain is already shutdown, but no error was raised.
|
|
|
|
# Probably means guest had no 'install' phase, as in
|
|
|
|
# for live cds. Try to restart the domain.
|
|
|
|
vm.startup()
|
2012-02-14 04:47:06 +08:00
|
|
|
elif guest.installer.has_install_phase():
|
2010-12-10 22:57:42 +08:00
|
|
|
# Register a status listener, which will restart the
|
|
|
|
# guest after the install has finished
|
2012-02-14 03:55:59 +08:00
|
|
|
def cb():
|
|
|
|
vm.connect_opt_out("status-changed",
|
|
|
|
self.check_install_status, guest)
|
|
|
|
return False
|
|
|
|
self.idle_add(cb)
|
2007-04-11 06:50:04 +08:00
|
|
|
|
2007-06-23 01:32:13 +08:00
|
|
|
|
2010-03-01 08:40:06 +08:00
|
|
|
def check_install_status(self, vm, ignore1, ignore2, virtinst_guest=None):
|
|
|
|
if vm.is_crashed():
|
|
|
|
logging.debug("VM crashed, cancelling install plans.")
|
|
|
|
return True
|
|
|
|
|
|
|
|
if not vm.is_shutoff():
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
if virtinst_guest:
|
|
|
|
continue_inst = virtinst_guest.get_continue_inst()
|
|
|
|
|
|
|
|
if continue_inst:
|
|
|
|
logging.debug("VM needs a 2 stage install, continuing.")
|
|
|
|
# Continue the install, then reconnect this opt
|
|
|
|
# out handler, removing the virtinst_guest which
|
|
|
|
# will force one final restart.
|
|
|
|
virtinst_guest.continue_install()
|
2010-05-13 23:21:01 +08:00
|
|
|
|
2011-04-18 06:27:41 +08:00
|
|
|
vm.connect_opt_out("status-changed",
|
|
|
|
self.check_install_status, None)
|
2010-03-01 08:40:06 +08:00
|
|
|
return True
|
|
|
|
|
2010-05-13 23:21:01 +08:00
|
|
|
if vm.get_install_abort():
|
|
|
|
logging.debug("User manually shutdown VM, not restarting "
|
|
|
|
"guest after install.")
|
|
|
|
return True
|
|
|
|
|
2010-03-01 08:40:06 +08:00
|
|
|
logging.debug("Install should be completed, starting VM.")
|
|
|
|
vm.startup()
|
|
|
|
except Exception, e:
|
2011-04-06 23:22:03 +08:00
|
|
|
self.err.show_err(_("Error continue install: %s") % str(e))
|
2010-03-01 08:40:06 +08:00
|
|
|
|
|
|
|
return True
|
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def pretty_storage(self, size):
|
2012-01-30 10:51:07 +08:00
|
|
|
return "%.1f GB" % float(size)
|
2007-06-23 01:32:13 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def pretty_memory(self, mem):
|
2010-12-11 00:47:07 +08:00
|
|
|
return "%d MB" % (mem / 1024.0)
|
2009-03-10 04:16:45 +08:00
|
|
|
|
2008-04-09 03:22:53 +08:00
|
|
|
|
2012-02-10 19:58:45 +08:00
|
|
|
# Distro detection methods
|
2013-10-05 22:29:16 +08:00
|
|
|
def set_distro_labels(self, distro, ver, force=False):
|
2009-03-10 04:16:45 +08:00
|
|
|
# Helper to set auto detect result labels
|
2013-10-05 22:29:16 +08:00
|
|
|
if not force and not self.is_detect_active():
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
2008-08-26 03:00:11 +08:00
|
|
|
|
2011-07-15 01:13:13 +08:00
|
|
|
self.widget("install-os-type-label").set_text(distro)
|
|
|
|
self.widget("install-os-version-label").set_text(ver)
|
2007-03-29 03:27:19 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def set_os_val(self, os_widget, value):
|
|
|
|
# Helper method to set the OS Type/Variant selections to the passed
|
|
|
|
# values, or -1 if not present.
|
|
|
|
model = os_widget.get_model()
|
2007-06-23 01:32:13 +08:00
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
def set_val():
|
|
|
|
idx = 0
|
|
|
|
for idx in range(0, len(model)):
|
|
|
|
row = model[idx]
|
|
|
|
if value and row[0] == value:
|
|
|
|
break
|
2007-03-22 00:28:36 +08:00
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
if idx == len(os_widget.get_model()) - 1:
|
|
|
|
idx = -1
|
2008-03-14 22:55:12 +08:00
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
os_widget.set_active(idx)
|
|
|
|
if idx == -1:
|
|
|
|
os_widget.set_active(0)
|
|
|
|
|
|
|
|
if idx >= 0:
|
|
|
|
return row[1]
|
|
|
|
if self.show_all_os:
|
|
|
|
return None
|
2008-03-15 01:18:44 +08:00
|
|
|
|
2011-07-26 06:53:09 +08:00
|
|
|
ret = set_val()
|
|
|
|
if ret:
|
|
|
|
return ret
|
|
|
|
|
|
|
|
# Trigger the last element in the list, which turns on show_all_os
|
|
|
|
os_widget.set_active(len(model) - 1)
|
|
|
|
ret = set_val()
|
|
|
|
if ret:
|
|
|
|
return ret
|
2010-12-05 02:22:04 +08:00
|
|
|
return _("Unknown")
|
2007-04-16 01:41:12 +08:00
|
|
|
|
2013-08-11 06:48:43 +08:00
|
|
|
def set_distro_selection(self, variant):
|
2009-03-10 04:16:45 +08:00
|
|
|
# Wrapper to change OS Type/Variant values, and update the distro
|
|
|
|
# detection labels
|
|
|
|
if not self.is_detect_active():
|
2007-04-24 03:08:56 +08:00
|
|
|
return
|
2007-02-20 12:11:21 +08:00
|
|
|
|
2013-08-11 06:48:43 +08:00
|
|
|
distro_type = None
|
|
|
|
distro_var = None
|
|
|
|
if variant:
|
|
|
|
osclass = virtinst.osdict.lookup_os(variant)
|
|
|
|
distro_type = osclass.typename
|
|
|
|
distro_var = osclass.name
|
|
|
|
|
|
|
|
dl = self.set_os_val(self.widget("install-os-type"), distro_type)
|
|
|
|
vl = self.set_os_val(self.widget("install-os-version"), distro_var)
|
2009-03-10 04:16:45 +08:00
|
|
|
self.set_distro_labels(dl, vl)
|
2007-02-20 00:52:37 +08:00
|
|
|
|
2012-02-10 19:58:45 +08:00
|
|
|
def check_detection(self, idx, forward):
|
|
|
|
results = None
|
2009-03-10 04:16:45 +08:00
|
|
|
try:
|
2012-02-10 19:58:45 +08:00
|
|
|
base = _("Detecting")
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2013-08-11 06:48:43 +08:00
|
|
|
if (self.detectedDistro == -1) or (idx >= (DETECT_TIMEOUT * 2)):
|
2012-02-10 19:58:45 +08:00
|
|
|
detect_str = base + ("." * ((idx % 3) + 1))
|
|
|
|
self.set_distro_labels(detect_str, detect_str)
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2012-02-11 03:07:51 +08:00
|
|
|
self.timeout_add(500, self.check_detection,
|
2012-02-10 19:58:45 +08:00
|
|
|
idx + 1, forward)
|
2009-03-10 04:16:45 +08:00
|
|
|
return
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2012-02-10 19:58:45 +08:00
|
|
|
results = self.detectedDistro
|
|
|
|
except:
|
|
|
|
logging.exception("Error in distro detect timeout")
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2013-08-11 06:48:43 +08:00
|
|
|
if results == -1:
|
|
|
|
results = None
|
2012-02-10 19:58:45 +08:00
|
|
|
self.widget("create-forward").set_sensitive(True)
|
|
|
|
self.mediaDetected = True
|
|
|
|
self.detecting = False
|
|
|
|
logging.debug("Finished OS detection.")
|
2013-08-11 06:48:43 +08:00
|
|
|
self.set_distro_selection(results)
|
2012-02-10 19:58:45 +08:00
|
|
|
if forward:
|
2012-02-11 03:07:51 +08:00
|
|
|
self.idle_add(self.forward, ())
|
2012-02-10 19:58:45 +08:00
|
|
|
|
|
|
|
def start_detection(self, forward):
|
|
|
|
if self.detecting:
|
|
|
|
return
|
2007-02-20 12:11:21 +08:00
|
|
|
|
2012-02-10 19:58:45 +08:00
|
|
|
media = self.get_config_detectable_media()
|
|
|
|
if not media:
|
|
|
|
return
|
2007-02-20 12:11:21 +08:00
|
|
|
|
2013-08-11 06:48:43 +08:00
|
|
|
self.detectedDistro = -1
|
2007-02-20 12:11:21 +08:00
|
|
|
|
2012-02-10 19:58:45 +08:00
|
|
|
logging.debug("Starting OS detection thread for media=%s", media)
|
|
|
|
self.widget("create-forward").set_sensitive(False)
|
|
|
|
|
|
|
|
detectThread = threading.Thread(target=self.actually_detect,
|
|
|
|
name="Actual media detection",
|
|
|
|
args=(media,))
|
|
|
|
detectThread.setDaemon(True)
|
|
|
|
detectThread.start()
|
|
|
|
|
|
|
|
self.check_detection(0, forward)
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2009-03-10 04:16:45 +08:00
|
|
|
def actually_detect(self, media):
|
|
|
|
try:
|
2013-07-17 19:53:47 +08:00
|
|
|
installer = virtinst.DistroInstaller(self.conn)
|
2009-03-10 04:16:45 +08:00
|
|
|
installer.location = media
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
self.detectedDistro = installer.detect_distro(self.guest)
|
2009-03-10 04:16:45 +08:00
|
|
|
except:
|
|
|
|
logging.exception("Error detecting distro.")
|
2013-08-11 06:48:43 +08:00
|
|
|
self.detectedDistro = -1
|
2008-03-10 06:18:33 +08:00
|
|
|
|
2014-01-21 00:09:13 +08:00
|
|
|
def _stable_defaults(self):
|
2011-07-26 07:13:38 +08:00
|
|
|
emu = None
|
|
|
|
if self.guest:
|
|
|
|
emu = self.guest.emulator
|
|
|
|
elif self.capsdomain:
|
|
|
|
emu = self.capsdomain.emulator
|
|
|
|
|
2014-01-21 00:09:13 +08:00
|
|
|
ret = self.conn.stable_defaults(emu)
|
2011-07-26 07:13:38 +08:00
|
|
|
return ret
|
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
def _browse_file(self, cbwidget, cb=None, is_media=False, is_dir=False):
|
2009-06-24 07:30:12 +08:00
|
|
|
if is_media:
|
2011-07-23 07:12:48 +08:00
|
|
|
reason = self.config.CONFIG_DIR_ISO_MEDIA
|
2011-06-21 23:04:22 +08:00
|
|
|
elif is_dir:
|
|
|
|
reason = self.config.CONFIG_DIR_FS
|
2009-06-24 07:30:12 +08:00
|
|
|
else:
|
|
|
|
reason = self.config.CONFIG_DIR_IMAGE
|
|
|
|
|
2013-10-02 23:56:51 +08:00
|
|
|
if cb:
|
|
|
|
callback = cb
|
|
|
|
else:
|
|
|
|
def callback(ignore, text):
|
|
|
|
self.widget(cbwidget).set_text(text)
|
|
|
|
|
2012-11-08 21:15:02 +08:00
|
|
|
if self.storage_browser is None:
|
2010-12-09 06:26:19 +08:00
|
|
|
self.storage_browser = vmmStorageBrowser(self.conn)
|
2009-11-11 03:30:51 +08:00
|
|
|
|
2014-01-21 00:09:13 +08:00
|
|
|
self.storage_browser.stable_defaults = self._stable_defaults()
|
2011-07-23 00:22:09 +08:00
|
|
|
|
2009-11-16 04:57:38 +08:00
|
|
|
self.storage_browser.set_vm_name(self.get_config_name())
|
2009-11-11 03:30:51 +08:00
|
|
|
self.storage_browser.set_finish_cb(callback)
|
|
|
|
self.storage_browser.set_browse_reason(reason)
|
2011-04-14 20:47:42 +08:00
|
|
|
self.storage_browser.show(self.topwin, self.conn)
|