home *** CD-ROM | disk | FTP | other *** search
Wrap
/** * Module: inst_vm_hardware.ycp * * Authors: Ladislav Slezak <lslezak@suse.cz> * Michael G. Fritch <mgfritch@novell.com> * * Purpose: Ask the user for various options for the virtual machine. * * $Id: inst_vm_options.ycp 28826 2006-03-10 14:35:49Z lslezak $ * */ { textdomain "vm"; import "VM"; import "VM_Common"; import "Wizard"; import "Popup"; import "String"; import "Report"; // screen title for virtual machine options string title = _("Hardware"); // build and show dialog Wizard::OpenAcceptDialog (); term contents = `MarginBox(15, 1, `HBox( `VBox( `ComboBox(`id(`memory), `opt(`editable,`hstretch), // combobox label _("&Memory Size in MB"), ["32", "64", "128", "256", "512", "1024"]), (VM::GetVirtualizationType() == "full") ? `VBox( `VSpacing(0.5), `ComboBox(`id(`stdvga), `opt(`hstretch), // combobox label _("Virtual Graphics Card"), [ // combobox item `item(`id(0), _("Cirrus Logic")), // combobox item `item(`id(1), _("Standard VGA")), ]), `VSpacing(0.5), `ComboBox(`id(`sdl), `opt(`hstretch), // combobox label _("Graphics Viewer"), [ // combobox item `item(`id(1), _("SDL")), // combobox item `item(`id(0), _("VNC")), ]), `VSpacing(0.5), `ComboBox(`id(`localtime), `opt(`hstretch), // combobox label _("Virtual Hardware Clock"), [ // combobox item `item(`id(1), _("Local Time")), // combobox item `item(`id(0), _("UTC")), ]) ) : // para virt `VBox( `VSpacing(0.5), `ComboBox(`id(`ncpus), `opt(`hstretch), // combobox label _("Number of Virtual &CPUs"), ["1", "2", "3", "4"]), `VSpacing(0.5), `ComboBox(`id(`localtime), `opt(`hstretch), // combobox label _("Virtual Hardware Clock"), [ // combobox item `item(`id(1), _("Local Time")), // combobox item `item(`id(0), _("UTC")), ]) ) ) ) ); // help text - hardware string help_text = _("<p><b><big>Hardware</big></b></p>") + _("<p><b>Memory size</b> specifies the amount of RAM, in megabytes, to allocate to the virtual machine when it starts.</p>"); if (VM::GetVirtualizationType() == "full") { help_text = help_text + _("<p>By default, Xen will emulate a <b>Cirrus Logic</b> graphics card for fully virtualized guests. If your operating system does not support that, select <b>Standard VGA</b>.</p>") + _("<p>You may display the fully virtualized guest's screen using <b>SDL</b> or <b>VNC</b>. SDL is best when displaying locally; VNC is better when displaying remotely. Note that closing an SDL window terminates the VM, whereas VNC can reconnect to the VM at any time.</p>"); } else { help_text = help_text + _("<p>The <b>number of virtual CPUs</b> may exceed the number of physical CPUs.</p>"); } help_text = help_text + _("<p>The <b>virtual hardware clock</b> can be set to local time or UTC. Pick the setting that is compatible with your VM's operating system.</p>"); Wizard::SetContents (title, contents, help_text, (boolean) WFM::Args(0), (boolean) WFM::Args(1)); UI::ChangeWidget (`id(`memory), `ValidChars, "0123456789"); UI::ChangeWidget (`id(`memory), `Value, tostring (VM::GetMemorySize())); // set widget state if (VM::GetVirtualizationType() == "full") { UI::ChangeWidget (`id(`stdvga), `Value, VM::GetStdVga()); UI::ChangeWidget (`id(`sdl), `Value, VM::GetSdl()); } else { UI::ChangeWidget (`id(`ncpus), `ValidChars, "0123456789"); UI::ChangeWidget (`id(`ncpus), `Value, tostring (VM::GetNumberOfCpus())); } UI::ChangeWidget (`id(`localtime), `Value, VM::GetLocaltime()); any ret = nil; while (true) { ret = Wizard::UserInput (); if (ret == `abort || ret == `cancel) { if (Popup::ReallyAbort(true)) break; } else if (ret == `back) { break; } if (ret == `next) { string mem_str = (string) UI::QueryWidget (`id(`memory), `Value); integer mem = tointeger(mem_str); integer freemem = (VM_Common::GetVirtualizationType() == "para") ? VM::GetMaxParaMemory() : VM::GetMaxHVMMemory(); if (mem > freemem) { // error message: requested memory size is greater that available free memory string memory_size_error = sformat(_("The requested memory size is larger than the amount of space currently available. There is %1MB free memory available."), freemem); Report::Error(memory_size_error); continue; } if (mem < 16) { Report::Error(_("Memory Size in MB cannot be less than 16 MB.")); continue; } VM::SetMemorySize(mem); if (VM::GetVirtualizationType() == "full") { VM::SetStdVga((integer) UI::QueryWidget (`id(`stdvga), `Value)); VM::SetSdl((integer) UI::QueryWidget (`id(`sdl), `Value)); VM::SetNumberOfCpus(1); // hard-code the ncups to 1 when full virtualization. } else { string ncpus_str = (string) UI::QueryWidget (`id(`ncpus), `Value); integer ncpus = tointeger(ncpus_str); VM::SetNumberOfCpus(ncpus); } VM::SetLocaltime((integer) UI::QueryWidget (`id(`localtime), `Value)); break; } else { y2error("unexpected retcode: %1", ret); continue; } } Wizard::CloseDialog (); return ret; /* EOF */ }