72 lines
2.4 KiB
Plaintext
72 lines
2.4 KiB
Plaintext
|
/* ------------------------------------------------------------------------------
|
||
|
* Copyright (c) 2013 Novell, Inc. All Rights Reserved.
|
||
|
*
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify it under
|
||
|
* the terms of version 2 of the GNU General Public License as published by the
|
||
|
* Free Software Foundation.
|
||
|
*
|
||
|
* 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, contact Novell, Inc.
|
||
|
*
|
||
|
* To contact Novell about this file by physical or electronic mail, you may find
|
||
|
* current contact information at www.novell.com.
|
||
|
* ------------------------------------------------------------------------------
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* File: clients/virt-install.ycp
|
||
|
* Package: Installation of a virtual machine
|
||
|
* Summary: Main VM installation YaST frontend for python based virt-install
|
||
|
* Authors: Charles E. Arnold <carnold@novell.com>
|
||
|
*
|
||
|
* $Id$
|
||
|
*/
|
||
|
|
||
|
{ // begin
|
||
|
import "Popup";
|
||
|
import "Arch";
|
||
|
|
||
|
textdomain "virt-install";
|
||
|
|
||
|
//===================================================================
|
||
|
// Start virt-install (GUI) or vm-install if Text mode (commandline)
|
||
|
//-------------------------------------------------------------------
|
||
|
integer status = 0;
|
||
|
map details = $[];
|
||
|
if (UI::TextMode())
|
||
|
{
|
||
|
y2milestone("Running virt-install in text mode is not supported. Running vm-install instead in command line mode.");
|
||
|
status = (integer)UI::RunInTerminal("/usr/bin/vm-install");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
y2milestone("Launching virt-manager to run virt-install in GUI mode.");
|
||
|
if ( Arch::is_xen() == false ) {
|
||
|
details = (map)SCR::Execute(.target.bash_output, "/usr/bin/virt-manager --connect=qemu:///system --show-domain-creator");
|
||
|
}
|
||
|
else {
|
||
|
details = (map)SCR::Execute(.target.bash_output, "/usr/bin/virt-manager --connect=xen:/// --show-domain-creator");
|
||
|
}
|
||
|
status = details["exit"]:0;
|
||
|
}
|
||
|
|
||
|
y2milestone("virt-install finished with exit code: <%1>", status);
|
||
|
if (status == 0) {
|
||
|
return `next;
|
||
|
} else {
|
||
|
if (size(details["stderr"]:"") > 0){
|
||
|
Popup::ErrorDetails(_("Failed to start virt-install"), (string)details["stderr"]:"");
|
||
|
} else {
|
||
|
Popup::Error(_("Failed to start virt-install"));
|
||
|
}
|
||
|
}
|
||
|
return `nil;
|
||
|
|
||
|
} // end
|
||
|
|