コード例 #1
0
	if (!isset($domain_cfg['VIRTIOISO'])) {
		$domain_cfg['VIRTIOISO'] = "";
	}

	$domain_debug = isset($domain_cfg['DEBUG']) ? $domain_cfg['DEBUG'] : "no";
	if ($domain_debug != "yes") {
		error_reporting(0);
	}

	$domain_bridge = (!($domain_cfg['BRNAME'])) ? 'virbr0' : $domain_cfg['BRNAME'];
	$msg = (empty($domain_bridge)) ? "Error: Setup Bridge in Settings/Network Settings" : false;
	$libvirt_service = isset($domain_cfg['SERVICE']) ?	$domain_cfg['SERVICE'] : "disable";

	if ($libvirt_running == "yes"){
		$lv = new Libvirt('qemu:///system', null, null, false);
		$arrHostInfo = $lv->host_get_node_info();
		$maxcpu = (int)$arrHostInfo['cpus'];
		$maxmem = number_format(($arrHostInfo['memory'] / 1048576), 1, '.', ' ');
	}

	$theme = $display['theme'];
	//set color on even rows for white or black theme
	function bcolor($row, $color) {
		if ($color == "white")
			$color = ($row % 2 == 0) ? "transparent" : "#F8F8F8";
		else
			$color = ($row % 2 == 0) ? "transparent" : "#0C0C0C";
		return $color;
	}
コード例 #2
0
<?php

require 'libvirt.php';
$lv = new Libvirt('qemu:///system');
$hn = $lv->get_hostname();
if ($hn == false) {
    die('Cannot open connection to hypervisor</body></html>');
}
$action = array_key_exists('action', $_GET) ? $_GET['action'] : false;
$subaction = array_key_exists('subaction', $_GET) ? $_GET['subaction'] : false;
if ($action == 'get-screenshot' && array_key_exists('uuid', $_GET)) {
    if (array_key_exists('width', $_GET) && $_GET['width']) {
        $tmp = $lv->domain_get_screenshot_thumbnail($_GET['uuid'], $_GET['width']);
    } else {
        $tmp = $lv->domain_get_screenshot($_GET['uuid']);
    }
    if (!$tmp) {
        echo $lv->get_last_error() . '<br />';
    } else {
        Header('Content-Type: image/png');
        die($tmp);
    }
}
?>
<html>
	<head>
		<title>Virtual server management</title>
	</head>
<body>
<?php 
require 'header.php';