DaanHoogland commented on code in PR #8802:
URL: https://github.com/apache/cloudstack/pull/8802#discussion_r1537501561
##########
plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java:
##########
@@ -285,15 +285,17 @@ public boolean connectPhysicalDisk(String volumePath,
KVMStoragePool pool, Map<S
try
{
- // allow 2 primaries for live migration, should be removed by
disconnect on the other end
- ResourceDefinitionModify rdm = new ResourceDefinitionModify();
- Properties props = new Properties();
- props.put("DrbdOptions/Net/allow-two-primaries", "yes");
- rdm.setOverrideProps(props);
- ApiCallRcList answers = api.resourceDefinitionModify(rscName, rdm);
- if (answers.hasError()) {
- s_logger.error("Unable to set 'allow-two-primaries' on " +
rscName);
- // do not fail here as adding allow-two-primaries property is
only a problem while live migrating
+ if (LinstorUtil.isResourceInUse(api, rscName)) {
+ // allow 2 primaries for live migration, should be removed by
disconnect on the other end
+ ResourceDefinitionModify rdm = new ResourceDefinitionModify();
+ Properties props = new Properties();
+ props.put("DrbdOptions/Net/allow-two-primaries", "yes");
+ rdm.setOverrideProps(props);
+ ApiCallRcList answers = api.resourceDefinitionModify(rscName,
rdm);
+ if (answers.hasError()) {
+ s_logger.error("Unable to set 'allow-two-primaries' on " +
rscName);
+ // do not fail here as adding allow-two-primaries property
is only a problem while live migrating
+ }
}
Review Comment:
have this block in a separate method, for readability?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]