1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Feature #2435 #2092: Rename HYBRID to PUBLIC_CLOUD

This commit is contained in:
Carlos Martín 2013-11-21 11:25:53 +01:00 committed by Javi Fontan
parent 4a71896ec6
commit b2cb9c10f6
13 changed files with 101 additions and 101 deletions

View File

@ -86,11 +86,11 @@ public:
(state == MONITORING_DISABLED));
}
/**
* Check if host is hybrid
* @return true if the host is enabled
*/
bool isHybrid() const;
/**
* Checks if the host is a remote public cloud
* @return true if the host is a remote public cloud
*/
bool is_public_cloud() const;
/**
* Disables the current host, it will not be monitored nor used by the

View File

@ -73,7 +73,7 @@ protected:
string& vnm,
int& cluster_id,
string& ds_location,
bool& is_hybrid,
bool& is_public_cloud,
PoolObjectAuth& host_perms,
RequestAttributes& att);

View File

@ -1389,20 +1389,20 @@ public:
void delete_snapshots();
// ------------------------------------------------------------------------
// Hybrid templates related functions
// Public cloud templates related functions
// ------------------------------------------------------------------------
/**
* Checks if the VM is hybrid
* @return true if the VM is hybrid
* Checks if the VM can be deployed in a public cloud provider
* @return true if the VM can be deployed in a public cloud provider
*/
bool is_hybrid() const;
bool is_public_cloud() const;
/**
* Gets the list of hybrid hypervisors for which this VM has definitions
* @return the list of hybrid hypervisors
* Gets the list of public cloud hypervisors for which this VM has definitions
* @return the list of public cloud hypervisors
*/
vector<string> get_hybrid_hypervisors() const;
vector<string> get_public_cloud_hypervisors() const;
private:

View File

@ -531,13 +531,13 @@ error_common:
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
bool Host::isHybrid() const
bool Host::is_public_cloud() const
{
bool is_hybrid = false;
bool is_public_cloud = false;
get_template_attribute("HYBRID", is_hybrid);
get_template_attribute("PUBLIC_CLOUD", is_public_cloud);
return is_hybrid;
return is_public_cloud;
}
/* ************************************************************************ */

View File

@ -322,7 +322,7 @@ int RequestManagerVirtualMachine::get_host_information(
string& vnm,
int& cluster_id,
string& ds_location,
bool& is_hybrid,
bool& is_public_cloud,
PoolObjectAuth& host_perms,
RequestAttributes& att)
@ -348,7 +348,7 @@ int RequestManagerVirtualMachine::get_host_information(
cluster_id = host->get_cluster_id();
is_hybrid = host->isHybrid();
is_public_cloud = host->is_public_cloud();
host->get_permissions(host_perms);
@ -626,7 +626,7 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
string vnm_mad;
int cluster_id;
string ds_location;
bool is_hybrid;
bool is_public_cloud;
PoolObjectAuth host_perms;
string tm_mad;
@ -658,7 +658,7 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
vnm_mad,
cluster_id,
ds_location,
is_hybrid,
is_public_cloud,
host_perms,
att) != 0)
{
@ -713,7 +713,7 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
// Get information about the system DS to use (tm_mad)
// ------------------------------------------------------------------------
if (is_hybrid)
if (is_public_cloud)
{
ds_id = -1;
}
@ -839,7 +839,7 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
string vnm_mad;
int cluster_id;
string ds_location;
bool is_hybrid;
bool is_public_cloud;
PoolObjectAuth host_perms;
int c_hid;
@ -869,14 +869,14 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
vnm_mad,
cluster_id,
ds_location,
is_hybrid,
is_public_cloud,
host_perms,
att) != 0)
{
return;
}
// TODO: return error for hybrid hosts?
// TODO: return error for public cloud hosts?
// ------------------------------------------------------------------------
// Authorize request

View File

@ -123,12 +123,12 @@ public:
};
/**
* Check if host is hybrid
* @return true if the host is enabled
* Checks if the host is a remote public cloud
* @return true if the host is a remote public cloud
*/
bool isHybrid() const
bool is_public_cloud() const
{
return hybrid;
return public_cloud;
}
private:
@ -148,7 +148,7 @@ private:
long long running_vms; /**< Number of running VMs in this Host */
bool hybrid;
bool public_cloud;
// Configuration attributes
static float hypervisor_mem; /**< Fraction of memory for the VMs */

View File

@ -116,12 +116,12 @@ public:
map<int,long long> get_storage_usage();
/**
* Checks if VM is hybrid
* @return true if the VM is enabled
* Checks if the VM can be deployed in a public cloud provider
* @return true if the VM can be deployed in a public cloud provider
*/
bool isHybrid() const
bool is_public_cloud() const
{
return hybrid;
return public_cloud;
};
//--------------------------------------------------------------------------
@ -198,15 +198,15 @@ public:
}
/**
* Marks the VM to be only deployed on hybrid hosts
* Marks the VM to be only deployed on public cloud hosts
*/
void set_only_hybrid();
void set_only_public_cloud();
/**
* Returns true is the VM can only be deployed in hybrid hosts
* @return true is the VM can only be deployed in hybrid hosts
* Returns true is the VM can only be deployed in public cloud hosts
* @return true is the VM can only be deployed in public cloud hosts
*/
bool is_only_hybrid() const;
bool is_only_public_cloud() const;
//--------------------------------------------------------------------------
// Capacity Interface
@ -302,7 +302,7 @@ protected:
ResourceMatch match_datastores;
bool only_hybrid;
bool only_public_cloud;
/* ----------------------- VIRTUAL MACHINE ATTRIBUTES ------------------- */
int oid;
@ -321,7 +321,7 @@ protected:
map<int,long long> ds_usage;
bool hybrid;
bool public_cloud;
string rank;
string requirements;

View File

@ -53,8 +53,8 @@ void HostXML::init_attributes()
//Reserve memory for the hypervisor
max_mem = static_cast<int>(hypervisor_mem * static_cast<float>(max_mem));
vector<string> hybrid_st_vector = (*this)["/HOST/TEMPLATE/HYBRID"];
hybrid = ( hybrid_st_vector.size() > 0 && hybrid_st_vector[0] == "YES" );
vector<string> public_cloud_vector = (*this)["/HOST/TEMPLATE/PUBLIC_CLOUD"];
public_cloud = ( public_cloud_vector.size() > 0 && public_cloud_vector[0] == "YES" );
vector<string> ds_ids = (*this)["/HOST/HOST_SHARE/DATASTORES/DS/ID"];
vector<string> ds_free_mb = (*this)["/HOST/HOST_SHARE/DATASTORES/DS/FREE_MB"];

View File

@ -210,19 +210,19 @@ void VirtualMachineXML::init_attributes()
}
vector<Attribute*> attrs;
user_template->get("HYBRID", attrs);
user_template->get("PUBLIC_CLOUD", attrs);
hybrid = (attrs.size() > 0);
public_cloud = (attrs.size() > 0);
if (hybrid == false)
if (public_cloud == false)
{
attrs.clear();
user_template->get("EC2", attrs);
hybrid = (attrs.size() > 0);
public_cloud = (attrs.size() > 0);
}
only_hybrid = false;
only_public_cloud = false;
}
/* -------------------------------------------------------------------------- */
@ -491,14 +491,14 @@ void VirtualMachineXML::add_image_datastore_capacity(
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void VirtualMachineXML::set_only_hybrid()
void VirtualMachineXML::set_only_public_cloud()
{
only_hybrid = true;
only_public_cloud = true;
ostringstream oss;
oss << "VM " << oid << ": Local Datastores do not have enough capacity. "
<< "This VM can be only deployed in a Hybrid Host.";
<< "This VM can be only deployed in a Public Cloud Host.";
NebulaLog::log("SCHED",Log::INFO,oss);
}
@ -506,7 +506,7 @@ void VirtualMachineXML::set_only_hybrid()
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
bool VirtualMachineXML::is_only_hybrid() const
bool VirtualMachineXML::is_only_public_cloud() const
{
return only_hybrid;
return only_public_cloud;
}

View File

@ -439,12 +439,12 @@ void Scheduler::match_schedule()
{
if (vm->test_image_datastore_capacity(img_dspool) == false)
{
if (vm->isHybrid())
if (vm->is_public_cloud())
{
// Image DS do not have capacity, but if the VM ends
// in a hybrid host, image copies will not
// in a public cloud host, image copies will not
// be performed.
vm->set_only_hybrid();
vm->set_only_public_cloud();
}
else
{
@ -511,12 +511,12 @@ void Scheduler::match_schedule()
// -----------------------------------------------------------------
// Check that VM can be deployed in local hosts
// -----------------------------------------------------------------
if (vm->is_only_hybrid() && !host->isHybrid())
if (vm->is_only_public_cloud() && !host->is_public_cloud())
{
ostringstream oss;
oss << "VM " << oid << ": Host " << host->get_hid()
<< " filtered out. VM can only be deployed in a Hybrid Host, but this one is local.";
<< " filtered out. VM can only be deployed in a Public Cloud Host, but this one is local.";
NebulaLog::log("SCHED",Log::DEBUG,oss);
continue;
@ -747,10 +747,10 @@ void Scheduler::match_schedule()
if (n_resources == 0)
{
// For a hybrid VM, 0 system DS is not a problem
if (vm->isHybrid())
// For a public cloud VM, 0 system DS is not a problem
if (vm->is_public_cloud())
{
vm->set_only_hybrid();
vm->set_only_public_cloud();
}
else
{
@ -860,12 +860,12 @@ void Scheduler::dispatch()
{
if (vm->test_image_datastore_capacity(img_dspool) == false)
{
if (vm->isHybrid())
if (vm->is_public_cloud())
{
// Image DS do not have capacity, but if the VM ends
// in a hybrid host, image copies will not
// in a public cloud host, image copies will not
// be performed.
vm->set_only_hybrid();
vm->set_only_public_cloud();
}
else
{
@ -903,7 +903,7 @@ void Scheduler::dispatch()
//------------------------------------------------------------------
// Check that VM can be deployed in local hosts
//------------------------------------------------------------------
if (vm->is_only_hybrid() && !host->isHybrid())
if (vm->is_only_public_cloud() && !host->is_public_cloud())
{
continue;
}
@ -925,8 +925,8 @@ void Scheduler::dispatch()
dsid = -1;
// Skip the loop for hybrid hosts, they don't need a system DS
if (host->isHybrid())
// Skip the loop for public cloud hosts, they don't need a system DS
if (host->is_public_cloud())
{
j = ds_resources.rend();
}
@ -992,7 +992,7 @@ void Scheduler::dispatch()
break;
}
if (dsid == -1 && !host->isHybrid())
if (dsid == -1 && !host->is_public_cloud())
{
ostringstream oss;
@ -1014,8 +1014,8 @@ void Scheduler::dispatch()
}
// DS capacity is only added for new deployments, not for migrations
// It is also omitted for VMs deployed in hybrid hosts
if (!vm->is_resched() && !host->isHybrid())
// It is also omitted for VMs deployed in public cloud hosts
if (!vm->is_resched() && !host->is_public_cloud())
{
if (ds->is_shared() && ds->is_monitored())
{

View File

@ -152,7 +152,7 @@ void TransferManager::do_action(const string &action, void * arg)
int hid;
VirtualMachine * vm;
Host * host;
bool host_is_hybrid = false;
bool host_is_public_cloud = false;
bool host_is_deleted = false;
Nebula& nd = Nebula::instance();
@ -202,13 +202,13 @@ void TransferManager::do_action(const string &action, void * arg)
}
else
{
host_is_hybrid=host->isHybrid();
host_is_public_cloud = host->is_public_cloud();
host->unlock();
}
if (action == "PROLOG")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::PROLOG_SUCCESS,vid);
}
@ -223,7 +223,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "PROLOG_MIGR")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::PROLOG_SUCCESS,vid);
}
@ -238,7 +238,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "PROLOG_RESUME")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::PROLOG_SUCCESS,vid);
}
@ -253,7 +253,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "EPILOG")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}
@ -268,7 +268,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "EPILOG_STOP")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}
@ -283,7 +283,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "EPILOG_DELETE")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}
@ -298,7 +298,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "EPILOG_DELETE_STOP")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}
@ -313,7 +313,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "EPILOG_DELETE_PREVIOUS")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}
@ -328,7 +328,7 @@ void TransferManager::do_action(const string &action, void * arg)
}
else if (action == "EPILOG_DELETE_BOTH")
{
if (host_is_hybrid)
if (host_is_public_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}

View File

@ -1130,7 +1130,7 @@ int VirtualMachine::automatic_requirements(string& error_str)
string requirements;
string cluster_id = "";
vector<string> hybrid_hypervisors = get_hybrid_hypervisors();
vector<string> public_cloud_hypervisors = get_public_cloud_hypervisors();
int incomp_id;
int rc;
@ -1209,22 +1209,22 @@ int VirtualMachine::automatic_requirements(string& error_str)
if ( !cluster_id.empty() )
{
oss << "CLUSTER_ID = " << cluster_id << " & !(HYBRID = YES)";
oss << "CLUSTER_ID = " << cluster_id << " & !(PUBLIC_CLOUD = YES)";
}
else
{
oss << "!(HYBRID = YES)";
oss << "!(PUBLIC_CLOUD = YES)";
}
if (!hybrid_hypervisors.empty())
if (!public_cloud_hypervisors.empty())
{
oss << " | (HYBRID = YES & (";
oss << " | (PUBLIC_CLOUD = YES & (";
oss << "HYPERVISOR = " << hybrid_hypervisors[0];
oss << "HYPERVISOR = " << public_cloud_hypervisors[0];
for (size_t i = 1; i < hybrid_hypervisors.size(); i++)
for (size_t i = 1; i < public_cloud_hypervisors.size(); i++)
{
oss << " | HYPERVISOR = " << hybrid_hypervisors[i];
oss << " | HYPERVISOR = " << public_cloud_hypervisors[i];
}
oss << "))";
@ -3666,9 +3666,9 @@ void VirtualMachine::clear_template_monitor_error()
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
bool VirtualMachine::is_hybrid() const
bool VirtualMachine::is_public_cloud() const
{
vector<string> v = get_hybrid_hypervisors();
vector<string> v = get_public_cloud_hypervisors();
return (v.size() > 0);
}
@ -3676,15 +3676,15 @@ bool VirtualMachine::is_hybrid() const
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
vector<string> VirtualMachine::get_hybrid_hypervisors() const
vector<string> VirtualMachine::get_public_cloud_hypervisors() const
{
vector<Attribute*> attrs;
vector<Attribute*>::const_iterator it;
VectorAttribute * vatt;
vector<string> hybrid_hypervisors;
vector<string> public_cloud_hypervisors;
user_obj_template->get("HYBRID", attrs);
user_obj_template->get("PUBLIC_CLOUD", attrs);
for (it = attrs.begin(); it != attrs.end(); it++)
{
@ -3699,7 +3699,7 @@ vector<string> VirtualMachine::get_hybrid_hypervisors() const
if (!type.empty())
{
hybrid_hypervisors.push_back(type);
public_cloud_hypervisors.push_back(type);
}
}
@ -3710,8 +3710,8 @@ vector<string> VirtualMachine::get_hybrid_hypervisors() const
if (!attrs.empty())
{
hybrid_hypervisors.push_back("ec2");
public_cloud_hypervisors.push_back("ec2");
}
return hybrid_hypervisors;
return public_cloud_hypervisors;
}

View File

@ -204,11 +204,11 @@ class EC2Driver
def initialize(host)
@host = host
hybrid_ec2_conf = YAML::load(File.read(EC2_DRIVER_CONF))
public_cloud_ec2_conf = YAML::load(File.read(EC2_DRIVER_CONF))
@instance_types = hybrid_ec2_conf['instance_types']
@instance_types = public_cloud_ec2_conf['instance_types']
regions = hybrid_ec2_conf['regions']
regions = public_cloud_ec2_conf['regions']
@region = regions[host] || regions["default"]
AWS.config(
@ -306,7 +306,7 @@ class EC2Driver
}
host_info = "HYPERVISOR=ec2\n"
host_info << "HYBRID=YES\n"
host_info << "PUBLIC_CLOUD=YES\n"
host_info << "TOTALMEMORY=#{totalmemory.round}\n"
host_info << "TOTALCPU=#{totalcpu}\n"
host_info << "CPUSPEED=1000\n"