コード例 #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;
	}

	//create checkboxes for usb devices
コード例 #2
0
         }
         $activity = $tmp2['active'] ? 'Active' : 'Inactive';
         $act = !$tmp2['active'] ? "<a href=\"?action={$_GET['action']}&amp;subaction=start&amp;name={$tmp2['name']}\">Start network</a>" : "<a href=\"?action={$_GET['action']}&amp;subaction=stop&amp;name={$tmp2['name']}\">Stop network</a>";
         $act .= " | <a href=\"?action={$_GET['action']}&amp;subaction=dumpxml&amp;name={$tmp2['name']}\">Dump network XML</a>";
         if (!$tmp2['active']) {
             $act .= ' | <a href="?action=' . $_GET['action'] . '&amp;subaction=edit&amp;name=' . $tmp2['name'] . '">Edit network</a>';
         }
         echo "<tr>\n\t\t\t\t\t<td>{$spaces}{$tmp2['name']}{$spaces}</td>\n\t\t\t\t\t<td align=\"center\">{$spaces}{$activity}{$spaces}</td>\n\t\t\t\t\t<td align=\"center\">{$spaces}{$tmp2['ip']}{$spaces}</td>\n\t\t\t\t\t<td align=\"center\">{$spaces}{$tmp2['ip_range']}{$spaces}</td>\n\t\t\t\t\t<td align=\"center\">{$spaces}{$forward}{$spaces}</td>\n\t\t\t\t\t<td align=\"center\">{$spaces}{$dhcp}{$spaces}</td>\n\t\t\t\t\t<td align=\"center\">{$spaces}{$act}{$spaces}</td>\n\t\t\t      </tr>";
     }
     echo "</table>";
     if ($ret) {
         echo "<pre>{$ret}</pre>";
     }
 } else {
     if ($action == 'host-information') {
         $tmp = $lv->host_get_node_info();
         $ci = $lv->get_connect_information();
         $info = '';
         if ($ci['uri']) {
             $info .= 'connected to <i>' . $ci['uri'] . '</i> on <i>' . $ci['hostname'] . '</i>, ';
         }
         if ($ci['encrypted'] == 'Yes') {
             $info .= 'encrypted, ';
         }
         if ($ci['secure'] == 'Yes') {
             $info .= 'secure, ';
         }
         if ($ci['hypervisor_maxvcpus']) {
             $info .= 'maximum ' . $ci['hypervisor_maxvcpus'] . ' vcpus per guest, ';
         }
         if (strlen($info) > 2) {