1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-26 10:03:37 +03:00

Bug #4395: Fix cluster check for manual resources

It was not working for volatile disks, nics with manual IP,
kernet with a manual instead of a file.
This commit is contained in:
Carlos Martín 2016-04-08 13:11:36 +02:00
parent 60e7358c32
commit 63a6b8e5f5
3 changed files with 11 additions and 9 deletions

View File

@ -119,10 +119,7 @@ void Datastore::disk_attribute(
set<int> cluster_ids = get_cluster_ids();
if (!cluster_ids.empty())
{
disk->replace("CLUSTER_ID", one_util::join(cluster_ids, ','));
}
disk->replace("CLUSTER_ID", one_util::join(cluster_ids, ','));
get_template_attribute("CLONE_TARGET", st);

View File

@ -1288,8 +1288,16 @@ static int check_and_set_cluster_id(
set<int> &cluster_ids)
{
set<int> vatt_cluster_ids;
string val;
one_util::split_unique(vatt->vector_value(id_name), ',', vatt_cluster_ids);
// If the attr does not exist, the vatt is using a manual path/resource.
// This is different to a resource with 0 clusters
if (vatt->vector_value(id_name, val) != 0)
{
return 0;
}
one_util::split_unique(val, ',', vatt_cluster_ids);
if ( vatt_cluster_ids.empty() )
{

View File

@ -610,10 +610,7 @@ int VirtualNetwork::nic_attribute(
set<int> cluster_ids = get_cluster_ids();
if (!cluster_ids.empty())
{
nic->replace("CLUSTER_ID", one_util::join(cluster_ids, ','));
}
nic->replace("CLUSTER_ID", one_util::join(cluster_ids, ','));
for (it = inherit_attrs.begin(); it != inherit_attrs.end(); it++)
{