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

Merge branch 'feature-2202'

This commit is contained in:
Ruben S. Montero 2014-02-06 22:38:05 +01:00
commit b3f9173197
2 changed files with 146 additions and 112 deletions

View File

@ -404,24 +404,6 @@ VM_MAD = [
# -t: number of threads, i.e. number of transfers made at the same time
# -d: list of transfer drivers separated by commas, if not defined all the
# drivers available will be enabled
#
# The configuration for each driver is defined in TM_MAD_CONF. These
# values are used when creating a new datastore and should not be modified
# since they define the datastore behaviour.
# name : name of the transfer driver, listed in the -d option of the
# TM_MAD section
# ln_target : determines how the persistent images will be cloned when
# a new VM is instantiated.
# NONE: The image will be linked and no more storage capacity will be used
# SELF: The image will be cloned in the Images datastore
# SYSTEM: The image will be cloned in the System datastore
# clone_target : determines how the non persistent images will be
# cloned when a new VM is instantiated.
# NONE: The image will be linked and no more storage capacity will be used
# SELF: The image will be cloned in the Images datastore
# SYSTEM: The image will be cloned in the System datastore
# shared : determines if the storage holding the system datastore is shared
# among the different hosts or not. Valid values: "yes" or "no"
#*******************************************************************************
TM_MAD = [
@ -429,62 +411,6 @@ TM_MAD = [
arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph"
]
TM_MAD_CONF = [
name = "dummy",
ln_target = "NONE",
clone_target= "SYSTEM",
shared = "yes"
]
TM_MAD_CONF = [
name = "lvm",
ln_target = "NONE",
clone_target= "SELF",
shared = "yes"
]
TM_MAD_CONF = [
name = "shared",
ln_target = "NONE",
clone_target= "SYSTEM",
shared = "yes"
]
TM_MAD_CONF = [
name = "fs_lvm",
ln_target = "SYSTEM",
clone_target= "SYSTEM",
shared = "yes"
]
TM_MAD_CONF = [
name = "qcow2",
ln_target = "NONE",
clone_target= "SYSTEM",
shared = "yes"
]
TM_MAD_CONF = [
name = "ssh",
ln_target = "SYSTEM",
clone_target= "SYSTEM",
shared = "no"
]
TM_MAD_CONF = [
name = "vmfs",
ln_target = "NONE",
clone_target= "SYSTEM",
shared = "yes"
]
TM_MAD_CONF = [
name = "ceph",
ln_target = "NONE",
clone_target= "SELF",
shared = "yes"
]
#*******************************************************************************
# Datastore Driver Configuration
#*******************************************************************************
@ -686,6 +612,15 @@ SESSION_EXPIRATION_TIME = 900
DEFAULT_UMASK = 177
#*******************************************************************************
# OneGate
# ONEGATE_ENDPOINT: The URL for the onegate server (the Gate to OpenNebula for
# VMs). The onegate server is started using a separate command. The endpoint
# MUST be consistent with the values in onegate-server.conf
#*******************************************************************************
#ONEGATE_ENDPOINT = "http://frontend:5030"
#*******************************************************************************
# Restricted Attributes Configuration
#*******************************************************************************
@ -704,12 +639,6 @@ VM_RESTRICTED_ATTR = "NIC/BRIDGE"
IMAGE_RESTRICTED_ATTR = "SOURCE"
#*******************************************************************************
# OneGate
#*******************************************************************************
#ONEGATE_ENDPOINT = "http://frontend:5030"
#*******************************************************************************
# Inherited Attributes Configuration
#*******************************************************************************
@ -735,4 +664,61 @@ INHERIT_DATASTORE_ATTR = "CEPH_HOST"
INHERIT_DATASTORE_ATTR = "CEPH_SECRET"
INHERIT_DATASTORE_ATTR = "CEPH_USER"
INHERIT_DATASTORE_ATTR = "GLUSTER_HOST"
INHERIT_DATASTORE_ATTR = "GLUSTER_VOLUME"
INHERIT_VNET_ATTR = "VLAN_TAGGED_ID"
#*******************************************************************************
# Transfer Manager Driver Behavior Configuration
#*******************************************************************************
# The configuration for each driver is defined in TM_MAD_CONF. These
# values are used when creating a new datastore and should not be modified
# since they define the datastore behavior.
# name : name of the transfer driver, listed in the -d option of the
# TM_MAD section
# ln_target : determines how the persistent images will be cloned when
# a new VM is instantiated.
# NONE: The image will be linked and no more storage capacity will be used
# SELF: The image will be cloned in the Images datastore
# SYSTEM: The image will be cloned in the System datastore
# clone_target : determines how the non persistent images will be
# cloned when a new VM is instantiated.
# NONE: The image will be linked and no more storage capacity will be used
# SELF: The image will be cloned in the Images datastore
# SYSTEM: The image will be cloned in the System datastore
# shared : determines if the storage holding the system datastore is shared
# among the different hosts or not. Valid values: "yes" or "no"
#*******************************************************************************
TM_MAD_CONF = [
name = "dummy", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
]
TM_MAD_CONF = [
name = "lvm", ln_target = "NONE", clone_target = "SELF", shared = "yes"
]
TM_MAD_CONF = [
name = "shared", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
]
TM_MAD_CONF = [
name = "fs_lvm", ln_target = "SYSTEM", clone_target = "SYSTEM", shared="yes"
]
TM_MAD_CONF = [
name = "qcow2", ln_target = "NONE", clone_target = "SYSTEM", shared = "yes"
]
TM_MAD_CONF = [
name = "ssh", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "no"
]
TM_MAD_CONF = [
name = "vmfs", ln_target = "NONE", clone_target= "SYSTEM", shared = "yes"
]
TM_MAD_CONF = [
name = "ceph", ln_target = "NONE", clone_target = "SELF", shared = "yes"
]

View File

@ -24,6 +24,56 @@
const float LibVirtDriver::CGROUP_BASE_CPU_SHARES = 1024;
/**
* This function generates the <host> element for network disks
*/
static void do_network_hosts(ofstream& file,
const string& cg_host,
const string& transport)
{
if (cg_host.empty())
{
file << "'/>" << endl;
return;
}
vector<string>::const_iterator it;
vector<string> hosts;
hosts = one_util::split(cg_host, ' ');
file << "'>" << endl;
for (it = hosts.begin(); it != hosts.end(); it++)
{
vector<string> parts = one_util::split(*it, ':');
if (parts.empty())
{
continue;
}
file << "\t\t\t\t<host name='" << parts[0];
if (parts.size() > 1)
{
file << "' port='" << parts[1];
}
if (!transport.empty())
{
file << "' transport='" << transport;
}
file << "'/>" << endl;
}
file << "\t\t\t</source>" << endl;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int LibVirtDriver::deployment_description_kvm(
const VirtualMachine * vm,
const string& file_name) const
@ -64,6 +114,8 @@ int LibVirtDriver::deployment_description_kvm(
string ceph_host = "";
string ceph_secret= "";
string ceph_user = "";
string gluster_host = "";
string gluster_volume = "";
int disk_id;
string default_driver = "";
@ -331,6 +383,8 @@ int LibVirtDriver::deployment_description_kvm(
ceph_host = disk->vector_value("CEPH_HOST");
ceph_secret = disk->vector_value("CEPH_SECRET");
ceph_user = disk->vector_value("CEPH_USER");
gluster_host = disk->vector_value("GLUSTER_HOST");
gluster_volume = disk->vector_value("GLUSTER_VOLUME");
disk->vector_value_str("DISK_ID", disk_id);
@ -379,38 +433,7 @@ int LibVirtDriver::deployment_description_kvm(
file << "-" << vm->get_oid() << "-" << disk_id;
}
if ( ceph_host.empty() )
{
file << "'/>" << endl;
}
else
{
vector<string>::const_iterator it;
vector<string> hosts = one_util::split(ceph_host, ' ');
file << "'>" << endl;
for (it = hosts.begin(); it != hosts.end(); it++)
{
vector<string> parts = one_util::split(*it, ':');
if (parts.empty())
{
continue;
}
file << "\t\t\t\t<host name='" << parts[0];
if (parts.size() > 1)
{
file << "' port='" << parts[1];
}
file << "'/>" << endl;
}
file << "\t\t\t</source>" << endl;
}
do_network_hosts(file, ceph_host, "");
if ( !ceph_secret.empty() && !ceph_user.empty())
{
@ -420,6 +443,31 @@ int LibVirtDriver::deployment_description_kvm(
<< "\t\t\t</auth>" << endl;
}
}
else if ( type == "GLUSTER" || type == "GLUSTER_CDROM" )
{
if ( type == "GLUSTER" )
{
file << "\t\t<disk type='network' device='disk'>" << endl;
}
else
{
file << "\t\t<disk type='network' device='cdrom'>" << endl;
}
file << "\t\t\t<source protocol='gluster' name='" << gluster_volume
<< "/";
if ( clone == "YES" )
{
file << vm->get_oid() << "/disk." << disk_id;
}
else
{
file << one_util::split(source, '/').back();
}
do_network_hosts(file, gluster_host, "tcp");
}
else if ( type == "CDROM" )
{
file << "\t\t<disk type='file' device='cdrom'>" << endl