Various updates.
This commit is contained in:
parent
1065fbc422
commit
2c0913637b
|
@ -41,11 +41,17 @@ return array(
|
||||||
|
|
||||||
// For now, XCP servers/pool masters must be defined in this file.
|
// For now, XCP servers/pool masters must be defined in this file.
|
||||||
'xcp' => array(
|
'xcp' => array(
|
||||||
//'pool 1' => array(
|
|
||||||
// 'url' => 'https://xcp1.example.net',
|
/*
|
||||||
// 'username' => 'username',
|
* You MUST configure the following entries to connect XO-Server to your
|
||||||
// 'password' => 'password'
|
* XCP pool.
|
||||||
//),
|
*/
|
||||||
|
// array(
|
||||||
|
// 'url' => 'https://xcp1.example.net',
|
||||||
|
// 'username' => 'username',
|
||||||
|
// 'password' => 'password'
|
||||||
|
// ),
|
||||||
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -456,8 +456,9 @@ final class Application extends Base
|
||||||
$mgr_vms = $this->_di->get('vms');
|
$mgr_vms = $this->_di->get('vms');
|
||||||
$mgr_metrics = $this->_di->get('vms_metrics');
|
$mgr_metrics = $this->_di->get('vms_metrics');
|
||||||
|
|
||||||
$memory = 0;
|
$memory = 0;
|
||||||
$vcpus = 0;
|
$n_vcpus = 0;
|
||||||
|
$n_vifs = 0;
|
||||||
|
|
||||||
$running_vms = $mgr_vms->get(array(
|
$running_vms = $mgr_vms->get(array(
|
||||||
'power_state' => 'Running',
|
'power_state' => 'Running',
|
||||||
|
@ -468,7 +469,8 @@ final class Application extends Base
|
||||||
$metrics = $mgr_metrics->first($vm->metrics);
|
$metrics = $mgr_metrics->first($vm->metrics);
|
||||||
|
|
||||||
$memory += $metrics->memory_actual;
|
$memory += $metrics->memory_actual;
|
||||||
$vcpus += $metrics->VCPUs_number;
|
$n_vcpus += $metrics->VCPUs_number;
|
||||||
|
$n_vifs += count($vm->VIFs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo Replace with inequality filter when Rekodi implements it.
|
// @todo Replace with inequality filter when Rekodi implements it.
|
||||||
|
@ -502,7 +504,8 @@ final class Application extends Base
|
||||||
)),
|
)),
|
||||||
'running_vms' => count($running_vms),
|
'running_vms' => count($running_vms),
|
||||||
'memory' => $memory,
|
'memory' => $memory,
|
||||||
'vcpus' => $vcpus,
|
'vcpus' => $n_vcpus,
|
||||||
|
'vifs' => $n_vifs,
|
||||||
'srs' => $n_srs,
|
'srs' => $n_srs,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -577,6 +580,10 @@ final class Application extends Base
|
||||||
echo "Event: $class ($ref)\n";
|
echo "Event: $class ($ref)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isset($objects['message'])
|
||||||
|
and $this->_di->get('messages')->batchImport($objects['message']);
|
||||||
|
isset($objects['pool'])
|
||||||
|
and $this->_di->get('pools')->batchImport($objects['pool']);
|
||||||
isset($objects['sr'])
|
isset($objects['sr'])
|
||||||
and $this->_di->get('srs')->batchImport($objects['sr']);
|
and $this->_di->get('srs')->batchImport($objects['sr']);
|
||||||
isset($objects['vif'])
|
isset($objects['vif'])
|
||||||
|
@ -613,6 +620,8 @@ final class Application extends Base
|
||||||
|
|
||||||
// map(XCP class: manager)
|
// map(XCP class: manager)
|
||||||
$classes = array(
|
$classes = array(
|
||||||
|
'message' => 'messages',
|
||||||
|
'pool' => 'pools',
|
||||||
'SR' => 'srs',
|
'SR' => 'srs',
|
||||||
'VIF' => 'vifs',
|
'VIF' => 'vifs',
|
||||||
'VM' => 'vms',
|
'VM' => 'vms',
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is a part of Xen Orchestra Server.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is distributed in the hope that it will be
|
||||||
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||||
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Xen Orchestra Server. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @author Julien Fontanet <julien.fontanet@vates.fr>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3
|
||||||
|
*
|
||||||
|
* @package Xen Orchestra Server
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
final class Message extends BeanAbstract
|
||||||
|
{
|
||||||
|
protected static $_fields;
|
||||||
|
}
|
||||||
|
Message::init(array(
|
||||||
|
'id',
|
||||||
|
'uuid',
|
||||||
|
|
||||||
|
'timestamp',
|
||||||
|
'name',
|
||||||
|
'message',
|
||||||
|
'priority',
|
||||||
|
|
||||||
|
'cls', // Not class like in Event !!!
|
||||||
|
'obj_uuid',
|
||||||
|
));
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is a part of Xen Orchestra Server.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is distributed in the hope that it will be
|
||||||
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||||
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Xen Orchestra Server. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @author Julien Fontanet <julien.fontanet@vates.fr>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3
|
||||||
|
*
|
||||||
|
* @package Xen Orchestra Server
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
final class Pool extends BeanAbstract
|
||||||
|
{
|
||||||
|
protected static $_fields;
|
||||||
|
}
|
||||||
|
Pool::init(array(
|
||||||
|
'id',
|
||||||
|
'uuid',
|
||||||
|
|
||||||
|
'blobs' => true,
|
||||||
|
'crash_dump_SR',
|
||||||
|
'default_SR',
|
||||||
|
'gui_config' => true,
|
||||||
|
'ha_allow_overcommit',
|
||||||
|
'ha_configuration' => true,
|
||||||
|
'ha_enabled',
|
||||||
|
'ha_host_failures_to_tolerate',
|
||||||
|
'ha_overcommitted',
|
||||||
|
'ha_plan_exists_for',
|
||||||
|
'ha_statefiles' => true,
|
||||||
|
'master',
|
||||||
|
'metadata_VDIs' => true,
|
||||||
|
'name_description',
|
||||||
|
'name_label',
|
||||||
|
'other_config' => true,
|
||||||
|
'redo_log_enabled',
|
||||||
|
'redo_log_vdi',
|
||||||
|
'restrictions' => true,
|
||||||
|
'suspend_image_SR',
|
||||||
|
'tags' => true,
|
||||||
|
'uuid',
|
||||||
|
'vswitch_controller',
|
||||||
|
'wlb_enabled',
|
||||||
|
'wlb_url',
|
||||||
|
'wlb_username',
|
||||||
|
'wlb_verify_cert',
|
||||||
|
));
|
|
@ -33,6 +33,7 @@ final class SR extends BeanAbstract
|
||||||
}
|
}
|
||||||
SR::init(array(
|
SR::init(array(
|
||||||
'id',
|
'id',
|
||||||
|
'uuid',
|
||||||
|
|
||||||
'physical_size',
|
'physical_size',
|
||||||
));
|
));
|
||||||
|
|
|
@ -33,4 +33,5 @@ final class VIF extends BeanAbstract
|
||||||
}
|
}
|
||||||
VIF::init(array(
|
VIF::init(array(
|
||||||
'id',
|
'id',
|
||||||
|
'uuid',
|
||||||
));
|
));
|
||||||
|
|
|
@ -34,6 +34,7 @@ final class VM extends BeanAbstract
|
||||||
VM::init(array(
|
VM::init(array(
|
||||||
// Identifiers.
|
// Identifiers.
|
||||||
'id',
|
'id',
|
||||||
|
'uuid',
|
||||||
'name_label',
|
'name_label',
|
||||||
'resident_on', // The host this VM is currently resident on.
|
'resident_on', // The host this VM is currently resident on.
|
||||||
'domarch', // Domain architecture if available, null otherwise.
|
'domarch', // Domain architecture if available, null otherwise.
|
||||||
|
|
|
@ -33,6 +33,7 @@ final class VMGuestMetrics extends BeanAbstract
|
||||||
}
|
}
|
||||||
VMGuestMetrics::init(array(
|
VMGuestMetrics::init(array(
|
||||||
'id',
|
'id',
|
||||||
|
'uuid',
|
||||||
|
|
||||||
'memory' => true,
|
'memory' => true,
|
||||||
'networks' => true,
|
'networks' => true,
|
||||||
|
|
|
@ -33,6 +33,7 @@ final class VMMetrics extends BeanAbstract
|
||||||
}
|
}
|
||||||
VMMetrics::init(array(
|
VMMetrics::init(array(
|
||||||
'id',
|
'id',
|
||||||
|
'uuid',
|
||||||
|
|
||||||
'memory_actual',
|
'memory_actual',
|
||||||
'VCPUs_number',
|
'VCPUs_number',
|
||||||
|
|
19
lib/DI.php
19
lib/DI.php
|
@ -91,6 +91,16 @@ final class DI extends Base
|
||||||
{
|
{
|
||||||
$database = new \Rekodi\Manager\Memory;
|
$database = new \Rekodi\Manager\Memory;
|
||||||
|
|
||||||
|
$database->createTable('messages', function ($table) {
|
||||||
|
$table
|
||||||
|
->string('id')->unique()
|
||||||
|
;
|
||||||
|
});
|
||||||
|
$database->createTable('pools', function ($table) {
|
||||||
|
$table
|
||||||
|
->string('id')->unique()
|
||||||
|
;
|
||||||
|
});
|
||||||
$database->createTable('srs', function ($table) {
|
$database->createTable('srs', function ($table) {
|
||||||
$table
|
$table
|
||||||
->string('id')->unique()
|
->string('id')->unique()
|
||||||
|
@ -165,6 +175,15 @@ final class DI extends Base
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
// Managers
|
// Managers
|
||||||
|
|
||||||
|
private function _init_messages()
|
||||||
|
{
|
||||||
|
return new \Manager\Messages($this->get('database.cache'));
|
||||||
|
}
|
||||||
|
private function _init_pools()
|
||||||
|
{
|
||||||
|
return new \Manager\Pools($this->get('database.cache'));
|
||||||
|
}
|
||||||
|
|
||||||
private function _init_srs()
|
private function _init_srs()
|
||||||
{
|
{
|
||||||
return new \Manager\SRs($this->get('database.cache'));
|
return new \Manager\SRs($this->get('database.cache'));
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is a part of Xen Orchestra Server.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is distributed in the hope that it will be
|
||||||
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||||
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Xen Orchestra Server. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @author Julien Fontanet <julien.fontanet@vates.fr>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3
|
||||||
|
*
|
||||||
|
* @package Xen Orchestra Server
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Manager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
final class Messages extends XCPAbstract
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function __construct(\Rekodi\Manager $manager)
|
||||||
|
{
|
||||||
|
parent::__construct($manager, 'messages', '\Bean\Message');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is a part of Xen Orchestra Server.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is free software: you can redistribute it
|
||||||
|
* and/or modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Xen Orchestra Server is distributed in the hope that it will be
|
||||||
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||||
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Xen Orchestra Server. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @author Julien Fontanet <julien.fontanet@vates.fr>
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-3.0-standalone.html GPLv3
|
||||||
|
*
|
||||||
|
* @package Xen Orchestra Server
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Manager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
final class Pools extends XCPAbstract
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function __construct(\Rekodi\Manager $manager)
|
||||||
|
{
|
||||||
|
parent::__construct($manager, 'pools', '\Bean\Pool');
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,6 @@ final class VIFs extends XCPAbstract
|
||||||
*/
|
*/
|
||||||
function __construct(\Rekodi\Manager $manager)
|
function __construct(\Rekodi\Manager $manager)
|
||||||
{
|
{
|
||||||
parent::__construct($manager, 'vifs', '\Bean\VIFs');
|
parent::__construct($manager, 'vifs', '\Bean\VIF');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue