diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc index 9da01c2860..7f38554a56 100644 --- a/src/datastore/Datastore.cc +++ b/src/datastore/Datastore.cc @@ -119,10 +119,7 @@ void Datastore::disk_attribute( set 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); diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index e1b8ddb92d..7cf2ca9864 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -1288,8 +1288,16 @@ static int check_and_set_cluster_id( set &cluster_ids) { set 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() ) { diff --git a/src/vnm/VirtualNetwork.cc b/src/vnm/VirtualNetwork.cc index 7a1e39a551..9bce538471 100644 --- a/src/vnm/VirtualNetwork.cc +++ b/src/vnm/VirtualNetwork.cc @@ -610,10 +610,7 @@ int VirtualNetwork::nic_attribute( set 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++) {