Example #1
0
include 'functions/config.php';
require_once 'functions/functions.php';
if (!check_session()) {
    header("Location: {$serviceurl}/?error=1");
    exit;
}
$vm = addslashes($_GET['vm']);
$hypervisor = addslashes($_GET['hypervisor']);
$action = addslashes($_GET['action']);
if (empty($vm) || empty($hypervisor)) {
    exit;
}
$h_reply = get_SQL_line("SELECT * FROM hypervisors WHERE id='{$hypervisor}'");
ssh_connect($h_reply[2] . ":" . $h_reply[3]);
if ($action == "mass_on" || $action == "mass_off" || $action == "mass_destroy") {
    $child_vms = get_SQL_array("SELECT name FROM vms WHERE source_volume='{$vm}'");
    $x = 0;
    while ($child_vms[$x]['name']) {
        if ($action == "mass_on") {
            ssh_command("sudo virsh start " . $child_vms[$x]['name'], true);
        }
        if ($action == "mass_off") {
            ssh_command("sudo virsh shutdown " . $child_vms[$x]['name'], true);
        }
        if ($action == "mass_destroy") {
            ssh_command("sudo virsh destroy " . $child_vms[$x]['name'], true);
        }
        ++$x;
    }
}
if ($action == "single") {
Example #2
0
</option>
			<?php 
$x = 0;
while ($h_reply[$x]['id']) {
    echo '<option value="' . $h_reply[$x]['id'] . '">' . $h_reply[$x]['ip'] . '</option>';
    ++$x;
}
?>
	    	    </select>
		 </div>
	    </div>
	    <div class="row">
		<?php 
echo '<div class="col-md-5 hide" id="hypervisor-sourceimage">
			    <label>' . _("Use volume from:") . '</label>';
$v_reply = get_SQL_array("SELECT id,name,machine_type,hypervisor FROM vms WHERE (machine_type='sourcemachine' OR machine_type='initialmachine') ORDER By name");
$y = 0;
echo '<select class="form-control" name="source_volume" id="source_volume">' . "\n";
echo '<option selected value="">' . _("Please select source") . '</option>' . "\n";
while ($v_reply[$y]['id']) {
    echo '<option class="' . $v_reply[$y]['machine_type'] . ' hypervisor-' . $v_reply[$y]['hypervisor'] . '" value="' . $v_reply[$y]['id'] . '">' . $v_reply[$y]['name'] . '</option>' . "\n";
    ++$y;
}
echo '</select>' . "\n";
echo '</div>' . "\n";
?>
		    <div id="hypervisor-manualpath" class="hide">
		        <div class="col-md-5">
		    	    <label><?php 
echo _("Specify disk path:");
?>
Example #3
0
2015-12-23
*/
include 'functions/config.php';
require_once 'functions/functions.php';
if (!check_session()) {
    header("Location: {$serviceurl}/?error=1");
    exit;
}
$vm = addslashes($_GET['vm']);
$hypervisor = addslashes($_GET['hypervisor']);
if (empty($vm) || empty($hypervisor)) {
    exit;
}
$h_reply = get_SQL_line("SELECT * FROM hypervisors WHERE id='{$hypervisor}'");
$v_reply = get_SQL_line("SELECT * FROM vms WHERE id='{$vm}'");
$all_machines_reply = get_SQL_array("SELECT * FROM vms WHERE hypervisor='{$hypervisor}' ORDER BY name");
set_lang();
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<form method="POST" action="vm_update.php">
    <input type="hidden" name="hypervisor" value="<?php 
echo $hypervisor;
?>
">
    <input type="hidden" name="vm" value="<?php 
echo $vm;
Example #4
0
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<div class="alert alert-info" id="populatealert" style="display:none;">
 <?php 
echo _("<strong>Please wait!</strong> Populating virtual machines.");
?>
</div>
<div class="alert alert-info" id="copyalert" style="display:none;">
 <?php 
echo _("<strong>Please wait!</strong> Copying image.");
?>
</div>
	<?php 
$x = 0;
while ($sql_reply[$x]['id']) {
    $vms_query = get_SQL_array("SELECT vms.id,vms.name,vms.hypervisor,vms.machine_type,vms.source_volume,vms.snapshot,vms.maintenance,vms.filecopy,vms.state,vms_tmp.name AS sourcename  FROM vms LEFT JOIN vms AS vms_tmp ON vms.source_volume=vms_tmp.id WHERE vms.hypervisor='{$sql_reply[$x][id]}' ORDER BY vms.name");
    ?>
          <h1 class="sub-header"><?php 
    echo _("Hypervisor: ") . $sql_reply[$x]['ip'];
    ?>
</h1>
      <div class="table-responsive">
            <table class="table table-striped table-hover">
              <thead>
                <tr>
                  <th>#</th>
                  <th><?php 
    echo _("Machine name");
    ?>
</th>
		  <th><?php