GabrielBrascher commented on a change in pull request #2985: kvm/ceph: When
create a new RBD image use modern flags/features for t…
URL: https://github.com/apache/cloudstack/pull/2985#discussion_r229678901
##########
File path:
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
##########
@@ -72,7 +72,15 @@
private String _manageSnapshotPath;
private String rbdTemplateSnapName = "cloudstack-base-snap";
- private int rbdFeatures = (1 << 0); /* Feature 1<<0 means layering in RBD
format 2 */
+ /*
+ Ceph RBD features to use when creating a new RBD image
+ (1 << 0): RBD_FEATURE_LAYERING
+ (1 << 2): RBD_FEATURE_EXCLUSIVE_LOCK
+ (1 << 3): RBD_FEATURE_OBJECT_MAP
+ (1 << 4): RBD_FEATURE_FAST_DIFF
+ (1 << 5): RBD_FEATURE_DEEP_FLATTEN
+ */
+ private int rbdFeatures = (1 << 0) + (1 << 2) + (1 << 3) + (1 << 4) + (1
<< 5);
Review comment:
Agree that it is mainly a code style thing. But here are some suggestions as
well.
```
private final int RBD_FEATURE_LAYERING = 1;
private final int RBD_FEATURE_EXCLUSIVE_LOCK = 4;
private final int RBD_FEATURE_OBJECT_MAP = 8;
private final int RBD_FEATURE_FAST_DIFF = 16;
private final int RBD_FEATURE_DEEP_FLATTEN = 32;
private int rbdFeatures = RBD_FEATURE_LAYERING + RBD_FEATURE_EXCLUSIVE_LOCK
+ RBD_FEATURE_OBJECT_MAP + RBD_FEATURE_FAST_DIFF + RBD_FEATURE_DEEP_FLATTEN;
```
or
```
/**
Ceph RBD features to use when creating a new RBD image
RBD_FEATURE_LAYERING: 1
RBD_FEATURE_EXCLUSIVE_LOCK: 4
RBD_FEATURE_OBJECT_MAP: 8
RBD_FEATURE_FAST_DIFF: 16
RBD_FEATURE_DEEP_FLATTEN: 32
Total:61
*/
private final int RBF_FEATURES = 61;
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services