本文整理汇总了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";