diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 2db8e65c12..eea341cfc6 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -134,20 +134,27 @@ int RequestManagerVirtualMachine::get_host_information(int hid, host->unlock(); - cluster = nd.get_clpool()->get(cluster_id, true); - - if ( cluster == 0 ) + if ( cluster_id != -1 ) { - failure_response(NO_EXISTS, - get_error(object_name(PoolObjectSQL::CLUSTER),cluster_id), - att); + cluster = nd.get_clpool()->get(cluster_id, true); - return -1; + if ( cluster == 0 ) + { + failure_response(NO_EXISTS, + get_error(object_name(PoolObjectSQL::CLUSTER),cluster_id), + att); + + return -1; + } + + ds_id = cluster->get_ds_id(); + + cluster->unlock(); + } + else + { + ds_id = DatastorePool::SYSTEM_DS_ID; } - - ds_id = cluster->get_ds_id(); - - cluster->unlock(); ds = nd.get_dspool()->get(ds_id, true);