本文整理匯總了PHP中Server::hasRessources方法的典型用法代碼示例。如果您正苦於以下問題:PHP Server::hasRessources方法的具體用法?PHP Server::hasRessources怎麽用?PHP Server::hasRessources使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server
的用法示例。
在下文中一共展示了Server::hasRessources方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: action_start
public function action_start()
{
Routing::getInstance()->appendRender($this, "action_default");
$vm = new QemuVm($_GET['vmID']);
$status = Server::hasRessources($vm->ram);
if ($status == Server::RUN) {
if ($vm->isOwner()) {
if ($vm->status == QemuMonitor::RUNNING) {
return "<div class='notice'>Die VM scheint bereits aus zu laufen.</div>";
} else {
try {
$vm->startVM();
$vm->connect();
} catch (Exception $e) {
$vm->setStatus(QemuMonitor::SHUTDOWN);
return "<div class='notice warning'>Die VM scheint nicht zu starten.</div>";
}
if (!isset($e)) {
return "<div class='notice success'>Die VM wurde gestartet.</div>";
}
}
}
} elseif ($status == Server::USER_LIMIT) {
return "<div class='notice error'>Sie können maximal " . $GLOBALS['config']['running_vms'] . " VMs gleichzeitig laufen lassen</div>";
} else {
return "<div class='notice error'>Es sind keine Ressourcen mehr verfügbar um die VM zu starten</div>";
}
}
示例2: action_start
public function action_start()
{
$vm = new QemuVm($_GET['vmID']);
if (Server::hasRessources($vm->ram)) {
if ($vm->isOwner()) {
if ($vm->status == QemuMonitor::RUNNING) {
return "<div class='notice'>Die VM scheint bereits aus zu laufen.</div>";
} else {
try {
$vm->startVM();
$vm->connect();
} catch (Exception $e) {
$vm->setStatus(QemuMonitor::SHUTDOWN);
return "<div class='notice warning'>Die VM scheint nicht zu starten.</div>";
}
if (!isset($e)) {
return "<div class='notice success'>Die VM wurde gestartet.</div>";
}
}
}
} else {
return "<div class='notice error'>Es sind keine Ressourcen mehr verfügbar um die VM zu starten</div>";
}
}
示例3: QemuVm
<?php
include '../config.php';
include '../classes/Helper.class.php';
Helper::loadClasses();
if (isset($_SESSION['user'])) {
$vmID = (int) $_GET['vmID'];
$password = $_GET['pass'];
$vm = new QemuVm($vmID);
if (Server::hasRessources($vm->ram)) {
if ($vm->isOwner()) {
if ($vm->status == QemuMonitor::RUNNING) {
$vm->connect();
$vm->setVncPassword($password);
echo "OK";
die;
}
}
}
}
echo "ERROR";