kvm/ceph: When create a new RBD image use modern flags/features for t… - #2985
Conversation
|
This also partially fixes #2650 |
| (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); |
There was a problem hiding this comment.
How about define the feature as various final int hex values and rbdFeatures can be the or-ed value of those features. Should there also be some kind of version vs feature check?
There was a problem hiding this comment.
Yeah, I could also just write 61 as that's the default.
I took these values from the C-header file from Ceph so that people see what we actually use.
That's mainly a code style thing.
There was a problem hiding this 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;
There was a problem hiding this comment.
I like the first suggestion @GabrielBrascher makes, @wido . it comes down to "self documenting code by proper naming"
|
@blueorangutan package |
1 similar comment
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-2397 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
GabrielBrascher
left a comment
There was a problem hiding this comment.
Thanks for the PR @wido. Code LGTM.
| (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); |
There was a problem hiding this 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;
|
Trillian test result (tid-3136)
|
|
Thanks for the feedback! See the updated code |
DaanHoogland
left a comment
There was a problem hiding this comment.
won't pass without the static keyword
|
|
||
| private String rbdTemplateSnapName = "cloudstack-base-snap"; | ||
| private int rbdFeatures = (1 << 0); /* Feature 1<<0 means layering in RBD format 2 */ | ||
| private final int RBD_FEATURE_LAYERING = 1; |
There was a problem hiding this comment.
the errors with checkstuyle are due to the vars not being static (final). full capitalised is reserved for those constants only.
DaanHoogland
left a comment
There was a problem hiding this comment.
won't pass without the static keyword
DaanHoogland
left a comment
There was a problem hiding this comment.
won't pass without the static keyword
…he image These additional RBD features allow for faster lookups of how much space a RBD image is using, but with the exclusive locking we prevent two VMs from writing to the same RBD image at the same time. These are the default features used by Ceph for any new RBD image. Signed-off-by: Wido den Hollander <wido@widodh.nl>
|
Yes, I trusted my IDE to help with this, but fixed it now! Compiles :) |
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos6 ✔centos7 ✖debian. JID-2423 |
|
@blueorangutan test |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@wido @DaanHoogland @rhtyd merging it to the master branch, based on code review (3 LGTMs) and that all checks have passed. |
|
Trillian test result (tid-3163)
|
…he image
These additional RBD features allow for faster lookups of how much space a RBD
image is using, but with the exclusive locking we prevent two VMs from writing
to the same RBD image at the same time.
These are the default features used by Ceph for any new RBD image.
Signed-off-by: Wido den Hollander wido@widodh.nl
Description
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?