home *** CD-ROM | disk | FTP | other *** search
- /**
- * File: clients/xen.ycp
- * Module: Installation/management in a virtual machine
- * Summary: Main virtual machine installation/management
- * Authors: Ladislav Slezak <lslezak@suse.cz>
- *
- * $Id$
- */
-
- {
- textdomain "vm";
-
- import "Report";
- import "Arch";
- import "CommandLine";
- import "Popup";
- import "Label";
- import "Package";
- import "PackageLock";
- import "Mode";
-
- include "vm/cmdline.ycp";
-
- /**
- * Definition of command line mode options
- */
- map cmdline = $[
- // help text
- "id" : "vm",
- "guihandler": GUIhandler,
- ];
-
- // check whether VM can be started
- if (Arch::is_uml () == true)
- {
- // we are already in UML, nested virtual machine is not supported
- Report::Error(_("Virtual machine installation cannot be started inside the UML machine.
- Start installation in the host system.
- "));
-
- return `abort;
- }
-
- if (!Arch::is_xen() && !Mode::config())
- {
- // error - xen kernel must be running to start a new Xen domain,
- // ask user to configure the first (management) Xen domain
- if (Popup::YesNo(_("A Xen virtual machine can be started only
- from the VM Server (domain 0),
- which is not running now.
-
- Configure the VM Server now?")))
- {
- y2milestone("Starting domain0 configuration...");
- return (symbol) WFM::CallFunction("dom0_setup", []);
- }
- else
- {
- y2milestone("Skipping domain0 configuration");
- }
-
- return `abort;
- }
-
- // abort if the package manager is not available
- // note: Check() displays an error popup
- boolean manager_available = PackageLock::Check();
- if (!manager_available)
- {
- return `abort;
- }
-
- // initialize the target system
- Pkg::TargetInit("/", true);
-
- // install required packages if they are missing
- if (!Mode::config() && !Package::InstallAll(["xen-tools"]))
- {
- // installation failed
- return `abort;
- }
-
- // initialize the package manager library
- list sources = Pkg::SourceStartCache(true);
- y2milestone("Source init: %1", sources);
-
- // initialize to xen VM type
- import "VM";
- // set virtualization type here
- VM::SetVMMtype("xen");
-
- // initialize ProductControl module (load custom control file)
- import "VM_Common";
- VM_Common::InitProductControl();
-
- Pkg::TargetFinish();
-
- any ret = CommandLine::Run(cmdline);
-
- return `next;
- }
-