From 96a7dc0d9f7fc8167cd1c8fc7b4a8ebaa0f6ffd4 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Mon, 23 May 2011 12:58:37 +0200 Subject: [PATCH] feature #407: reuse cluster_id in function --- src/cluster/ClusterPool.cc | 5 +++-- src/host/Host.cc | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cluster/ClusterPool.cc b/src/cluster/ClusterPool.cc index ae5ff899c1..6628a25174 100644 --- a/src/cluster/ClusterPool.cc +++ b/src/cluster/ClusterPool.cc @@ -114,10 +114,9 @@ int ClusterPool::drop(Cluster * cluster) int cluster_id = cluster->get_oid(); ostringstream where; - where << "cid = " << cluster_id; // Return error if cluster is 'default' - if( cluster->get_oid() == DEFAULT_CLUSTER_ID ) + if( cluster_id == DEFAULT_CLUSTER_ID ) { NebulaLog::log("CLUSTER",Log::WARNING, "Default cluster cannot be deleted."); @@ -130,6 +129,8 @@ int ClusterPool::drop(Cluster * cluster) // Move the hosts assigned to the deleted cluster to the default one if( rc == 0 ) { + where << "cid = " << cluster_id; + hpool->search(hids, where.str()); for ( hid_it=hids.begin() ; hid_it < hids.end(); hid_it++ ) diff --git a/src/host/Host.cc b/src/host/Host.cc index c9abd04839..78bbb93872 100644 --- a/src/host/Host.cc +++ b/src/host/Host.cc @@ -28,8 +28,8 @@ /* ************************************************************************ */ Host::Host( - int id, - int cluster_id, + int id, + int cluster_id, const string& _hostname, const string& _im_mad_name, const string& _vmm_mad_name,