Revision f789d500 src/rm/RequestManagerVirtualMachine.cc
src/rm/RequestManagerVirtualMachine.cc | ||
---|---|---|
990 | 990 |
PoolObjectAuth * auth_ds_perms; |
991 | 991 |
|
992 | 992 |
int c_hid; |
993 |
int c_cluster_id; |
|
994 | 993 |
int c_ds_id; |
995 | 994 |
string c_tm_mad, tm_mad; |
996 | 995 |
bool c_is_public_cloud; |
997 | 996 |
|
997 |
set<int> cluster_ids; |
|
998 |
string tmp_str; |
|
999 |
|
|
998 | 1000 |
bool auth = false; |
1001 |
bool ds_migr; |
|
999 | 1002 |
|
1000 | 1003 |
string error; |
1001 | 1004 |
|
... | ... | |
1153 | 1156 |
return; |
1154 | 1157 |
} |
1155 | 1158 |
|
1159 |
vm->get_cluster_requirements(cluster_ids, tmp_str); |
|
1160 |
|
|
1156 | 1161 |
vm->unlock(); |
1157 | 1162 |
|
1158 |
// Check we are in the same cluster
|
|
1163 |
// Check we are migrating to a compatible cluster
|
|
1159 | 1164 |
Host * host = nd.get_hpool()->get(c_hid, true); |
1160 | 1165 |
|
1161 | 1166 |
if (host == 0) |
... | ... | |
1165 | 1170 |
failure_response(NO_EXISTS, att); |
1166 | 1171 |
} |
1167 | 1172 |
|
1168 |
c_cluster_id = host->get_cluster_id(); |
|
1169 |
|
|
1170 | 1173 |
c_is_public_cloud = host->is_public_cloud(); |
1171 | 1174 |
|
1172 | 1175 |
host->unlock(); |
1173 | 1176 |
|
1174 |
if ( c_cluster_id != cluster_id )
|
|
1177 |
if (cluster_ids.count(cluster_id) == 0)
|
|
1175 | 1178 |
{ |
1176 | 1179 |
ostringstream oss; |
1177 | 1180 |
|
1178 |
oss << "Cannot migrate to a different cluster. VM running in a host" |
|
1179 |
<< " in " << object_name(PoolObjectSQL::CLUSTER) << " [" |
|
1180 |
<< c_cluster_id << "] , and new host is in " |
|
1181 |
<< object_name(PoolObjectSQL::CLUSTER) << " [" << cluster_id << "]"; |
|
1181 |
oss << "Cannot migrate to host [" << hid << "]. Host is in cluster [" |
|
1182 |
<< cluster_id << "], and VM requires to be placed on cluster [" |
|
1183 |
<< one_util::join(cluster_ids, ',') << "]"; |
|
1182 | 1184 |
|
1183 | 1185 |
att.resp_msg = oss.str(); |
1184 | 1186 |
failure_response(ACTION, att); |
... | ... | |
1196 | 1198 |
|
1197 | 1199 |
if (ds_id != -1) |
1198 | 1200 |
{ |
1199 |
bool ds_migr; |
|
1200 |
|
|
1201 | 1201 |
if ( c_ds_id != ds_id && live ) |
1202 | 1202 |
{ |
1203 | 1203 |
att.resp_msg = "A migration to a different system datastore " |
... | ... | |
1218 | 1218 |
return; |
1219 | 1219 |
} |
1220 | 1220 |
|
1221 |
if (ds_cluster_ids.count(c_cluster_id) == 0) |
|
1222 |
{ |
|
1223 |
ostringstream oss; |
|
1224 |
|
|
1225 |
oss << "Cannot migrate to a different cluster. VM running in a host" |
|
1226 |
<< " in " << object_name(PoolObjectSQL::CLUSTER) |
|
1227 |
<< " [" << c_cluster_id << "] , and new system datastore is in " |
|
1228 |
<< object_name(PoolObjectSQL::CLUSTER) |
|
1229 |
<< " [" << one_util::join(ds_cluster_ids, ',') << "]"; |
|
1230 |
|
|
1231 |
att.resp_msg = oss.str(); |
|
1232 |
failure_response(ACTION, att); |
|
1233 |
|
|
1234 |
return; |
|
1235 |
} |
|
1236 |
|
|
1237 | 1221 |
if (c_tm_mad != tm_mad) |
1238 | 1222 |
{ |
1239 | 1223 |
att.resp_msg = "Cannot migrate to a system datastore with a different TM driver"; |
... | ... | |
1245 | 1229 |
else |
1246 | 1230 |
{ |
1247 | 1231 |
ds_id = c_ds_id; |
1248 |
tm_mad = c_tm_mad; |
|
1232 |
|
|
1233 |
if (get_ds_information(ds_id, ds_cluster_ids, tm_mad, att, ds_migr) != 0) |
|
1234 |
{ |
|
1235 |
return; |
|
1236 |
} |
|
1237 |
} |
|
1238 |
|
|
1239 |
if (ds_cluster_ids.count(cluster_id) == 0) |
|
1240 |
{ |
|
1241 |
ostringstream oss; |
|
1242 |
|
|
1243 |
oss << "Cannot migrate to host [" << hid << "] and system datastore [" << ds_id << "]. Host is in cluster [" |
|
1244 |
<< cluster_id << "], and the datastore is in cluster [" |
|
1245 |
<< one_util::join(ds_cluster_ids, ',') << "]"; |
|
1246 |
|
|
1247 |
att.resp_msg = oss.str(); |
|
1248 |
failure_response(ACTION, att); |
|
1249 |
|
|
1250 |
return; |
|
1249 | 1251 |
} |
1250 | 1252 |
|
1251 | 1253 |
// ------------------------------------------------------------------------ |
Also available in: Unified diff