Skip to content

Commit a1f547a

Browse files
committed
Merge remote-tracking branch 'origin/4.18' into 4.19
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Conflicts: plugins/storage/volume/linstor/src/main/java/org/apache/cloudstack/storage/datastore/util/LinstorUtil.java
2 parents 1d1b332 + 56f0448 commit a1f547a

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,27 +271,35 @@ public boolean connectPhysicalDisk(String volumePath, KVMStoragePool pool, Map<S
271271
}
272272

273273
final DevelopersApi api = getLinstorAPI(pool);
274+
String rscName;
274275
try
275276
{
276-
final String rscName = getLinstorRscName(volumePath);
277+
rscName = getLinstorRscName(volumePath);
277278

278279
ResourceMakeAvailable rma = new ResourceMakeAvailable();
279280
ApiCallRcList answers = api.resourceMakeAvailableOnNode(rscName, localNodeName, rma);
280281
checkLinstorAnswersThrow(answers);
281282

283+
} catch (ApiException apiEx) {
284+
s_logger.error(apiEx);
285+
throw new CloudRuntimeException(apiEx.getBestMessage(), apiEx);
286+
}
287+
288+
try
289+
{
282290
// allow 2 primaries for live migration, should be removed by disconnect on the other end
283291
ResourceDefinitionModify rdm = new ResourceDefinitionModify();
284292
Properties props = new Properties();
285293
props.put("DrbdOptions/Net/allow-two-primaries", "yes");
286294
rdm.setOverrideProps(props);
287-
answers = api.resourceDefinitionModify(rscName, rdm);
295+
ApiCallRcList answers = api.resourceDefinitionModify(rscName, rdm);
288296
if (answers.hasError()) {
289297
s_logger.error("Unable to set 'allow-two-primaries' on " + rscName);
290-
throw new CloudRuntimeException(answers.get(0).getMessage());
298+
// do not fail here as adding allow-two-primaries property is only a problem while live migrating
291299
}
292300
} catch (ApiException apiEx) {
293301
s_logger.error(apiEx);
294-
throw new CloudRuntimeException(apiEx.getBestMessage(), apiEx);
302+
// do not fail here as adding allow-two-primaries property is only a problem while live migrating
295303
}
296304
return true;
297305
}
@@ -355,19 +363,21 @@ public boolean disconnectPhysicalDiskByPath(String localPath)
355363
ApiCallRcList answers = api.resourceDefinitionModify(rsc.get().getName(), rdm);
356364
if (answers.hasError())
357365
{
358-
s_logger.error("Failed to remove 'allow-two-primaries' on " + rsc.get().getName());
359-
throw new CloudRuntimeException(answers.get(0).getMessage());
366+
s_logger.error(
367+
String.format("Failed to remove 'allow-two-primaries' on %s: %s",
368+
rsc.get().getName(), LinstorUtil.getBestErrorMessage(answers)));
369+
// do not fail here as removing allow-two-primaries property isn't fatal
360370
}
361371

362372
return true;
363373
}
364374
s_logger.warn("Linstor: Couldn't find resource for this path: " + localPath);
365375
} catch (ApiException apiEx) {
366-
s_logger.error(apiEx);
367-
throw new CloudRuntimeException(apiEx.getBestMessage(), apiEx);
376+
s_logger.error(apiEx.getBestMessage());
377+
// do not fail here as removing allow-two-primaries property isn't fatal
368378
}
369379
}
370-
return false;
380+
return true;
371381
}
372382

373383
@Override

0 commit comments

Comments
 (0)