Feature #2435 #2092: Code cleanup.

Hybrid hosts are not detected with the generic HYBRID=YES
This commit is contained in:
Carlos Martín authored and Javi Fontan committed 2013-11-21 18:51:08 +01:00
1 parent 539cadf098
commit 35fecb6dca
5 files changed
+8 -81

No files matched your search

-20
View File
@@ -92,15 +92,6 @@ public:
*/
bool isHybrid() const;
/**
* Return an element of the hypervisor array. The calling function
* must check that the index is valid.
*/
static const char * get_hybrid_hypervisor_by_id(int i)
{
return HYBRID_HYPERVISORS[i];
}
/**
* Disables the current host, it will not be monitored nor used by the
* scheduler
@@ -534,17 +525,6 @@ private:
static const char * monit_table;
/**
* Array containing the hybrid hypervisors, and counter. There is a
* correspondence between Host::HYBRID_HYPERVISOR and
* VirtualMachine::HYBRID_ATTRIBUTES. Attributes in HYBRID_ATTRIBUTES[i] are
* meant to be used in hosts reporting a a hypervisor of type
* HYBRID_HYPERVISOR[i]
*/
static const char * HYBRID_HYPERVISORS[];
static const int NUM_HYBRID_HYPERVISORS;
/**
* Execute an INSERT or REPLACE Sql query.
* @param db The SQL DB
-18
View File
@@ -67,30 +67,12 @@ public:
*/
void remove_all_except_restricted();
/**
* Returns the hypervisor name if the template is hybrid
* @param hypervisor the resulting hypervisor string
* @return true if any hybrid hypervisor attribute found, false otherwise
*/
bool get_hybrid_hypervisor(string& hypervisor) const;
private:
friend class VirtualMachinePool;
static vector<string> restricted_attributes;
/**
* Array containing the hybrid attributes, and counter. There is a
* correspondence between Host::HYBRID_HYPERVISOR and
* VirtualMachine::HYBRID_ATTRIBUTES. Attributes in HYBRID_ATTRIBUTES[i] are
* meant to be used in hosts reporting a a hypervisor of type
* HYBRID_HYPERVISOR[i]
*/
static const char * HYBRID_ATTRIBUTES[];
static const int NUM_HYBRID_ATTRIBUTES;
/**
* Stores the attributes as restricted, these attributes will be used in
* VirtualMachineTemplate::check
-7
View File
@@ -23,13 +23,6 @@
#include "Host.h"
#include "Nebula.h"
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
const char * Host::HYBRID_HYPERVISORS[] = {"EC2"};
const int Host::NUM_HYBRID_HYPERVISORS = 1;
/* ************************************************************************ */
/* Host :: Constructor/Destructor */
/* ************************************************************************ */
+8 -8
View File
@@ -390,7 +390,7 @@ void Scheduler::match_schedule()
int oid;
int uid;
int gid;
int n_hosts;
int n_resources;
int n_matched;
int n_auth;
int n_error;
@@ -427,7 +427,7 @@ void Scheduler::match_schedule()
vm->get_requirements(vm_cpu,vm_memory,vm_disk);
n_hosts = 0;
n_resources = 0;
n_matched = 0;
n_auth = 0;
n_error = 0;
@@ -577,7 +577,7 @@ void Scheduler::match_schedule()
{
vm->add_match_host(host->get_hid());
n_hosts++;
n_resources++;
}
else
{
@@ -594,7 +594,7 @@ void Scheduler::match_schedule()
// Log scheduling errors to VM user if any
// ---------------------------------------------------------------------
if (n_hosts == 0) //No hosts assigned, let's see why
if (n_resources == 0) //No hosts assigned, let's see why
{
if (n_error == 0) //No syntax error
{
@@ -654,7 +654,7 @@ void Scheduler::match_schedule()
ds_reqs = vm->get_ds_requirements();
n_hosts = 0;
n_resources = 0;
n_matched = 0;
n_error = 0;
@@ -719,7 +719,7 @@ void Scheduler::match_schedule()
{
vm->add_match_datastore(ds->get_oid());
n_hosts++;
n_resources++;
}
else
{
@@ -737,7 +737,7 @@ void Scheduler::match_schedule()
// capacity will be checked later for each host
vm->add_match_datastore(ds->get_oid());
n_hosts++;
n_resources++;
}
}
@@ -745,7 +745,7 @@ void Scheduler::match_schedule()
// Log scheduling errors to VM user if any
// ---------------------------------------------------------------------
if (n_hosts == 0)
if (n_resources == 0)
{
// For a hybrid VM, 0 system DS is not a problem
if (vm->isHybrid())
-28
View File
@@ -22,14 +22,6 @@
vector<string> VirtualMachineTemplate::restricted_attributes;
/* ************************************************************************ */
/* Hybrid Attributes */
/* ************************************************************************ */
const char * VirtualMachineTemplate::HYBRID_ATTRIBUTES[] = {"EC2"};
const int VirtualMachineTemplate::NUM_HYBRID_ATTRIBUTES = 1;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
@@ -143,23 +135,3 @@ void VirtualMachineTemplate::remove_all_except_restricted()
set(*res_it);
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
bool VirtualMachineTemplate::get_hybrid_hypervisor(string& hypervisor) const
{
vector<const Attribute *> attrs;
bool found_it = false;
for(int i=0; i < NUM_HYBRID_ATTRIBUTES; i++)
{
if(get(HYBRID_ATTRIBUTES[i],attrs))
{
hypervisor = Host::get_hybrid_hypervisor_by_id(i);
found_it = true;
break;
}
}
return found_it;
}