1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-25 02:50:08 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Ruben S. Montero 2013-10-31 15:00:12 +01:00
commit 779d2d6dbc
4 changed files with 24 additions and 3 deletions

View File

@ -64,6 +64,10 @@ class DummyInformationManager < OpenNebulaDriver
results << "USEDCPU=#{used_cpu}\n"
results << "FREECPU=#{800-used_cpu}\n"
results << "DS_LOCATION_USED_MB=9720\n"
results << "DS_LOCATION_TOTAL_MB=20480\n"
results << "DS_LOCATION_FREE_MB=20480\n"
results = Base64::encode64(results).strip.delete("\n")
send_message("MONITOR", RESULT[:success], number, results)

View File

@ -74,6 +74,16 @@ public:
return shared;
};
/**
* Returns true if the DS free_mb is not 0. Only for shared DS
* @return true if the DS is monitored
*/
bool is_monitored()
{
return monitored;
};
private:
int oid;
@ -81,6 +91,8 @@ private:
long long free_mb; /**< Free disk for VMs (in MB). */
bool monitored;
bool shared;
static const char *ds_paths[]; /**< paths for search function */

View File

@ -38,6 +38,11 @@ void DatastoreXML::init_attributes()
cluster_id = atoi(((*this)["/DATASTORE/CLUSTER_ID"] )[0].c_str() );
free_mb = atoll(((*this)["/DATASTORE/FREE_MB"])[0].c_str());
long long total_mb = atoll(((*this)["/DATASTORE/TOTAL_MB"])[0].c_str());
long long used_mb = atoll(((*this)["/DATASTORE/USED_MB"])[0].c_str());
monitored = (free_mb != 0 || total_mb != 0 || used_mb != 0);
string shared_st;
this->xpath(shared_st, "/DATASTORE/TEMPLATE/SHARED", "YES");

View File

@ -684,7 +684,7 @@ void Scheduler::match_schedule()
// Check datastore capacity
// -----------------------------------------------------------------
if (ds->is_shared())
if (ds->is_shared() && ds->is_monitored())
{
if (ds->test_capacity(vm_disk))
{
@ -886,7 +886,7 @@ void Scheduler::dispatch()
if (!vm->is_resched())
{
if (ds->is_shared())
if (ds->is_shared() && ds->is_monitored())
{
test_cap_result = ds->test_capacity(dsk);
}
@ -944,7 +944,7 @@ void Scheduler::dispatch()
// DS capacity is only added for new deployments, not for migrations
if (!vm->is_resched())
{
if (ds->is_shared())
if (ds->is_shared() && ds->is_monitored())
{
ds->add_capacity(dsk);
}