-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Hypervisor default
as cache mode for disk offerings
#10282
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -708,7 +708,7 @@ public String toString() { | |
} | ||
|
||
public enum DiskCacheMode { | ||
NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"); | ||
HYPERVISOR_DEFAULT("default"), NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
String _diskCacheMode; | ||
|
||
DiskCacheMode(String cacheMode) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
this.type = ProvisioningType.getProvisioningType(hiddenDiskOffering.getProvisioningType().toString()); | ||
} | ||
if (hiddenDiskOffering.getCacheMode() != null) { | ||
this.diskCacheMode = DiskCacheMode.getDiskCasehMode(hiddenDiskOffering.getCacheMode().toString()); | ||
this.diskCacheMode = DiskCacheMode.getDiskCacheMode(hiddenDiskOffering.getCacheMode().toString()); | ||
Check warning on line 37 in plugins/storage/volume/adaptive/src/main/java/org/apache/cloudstack/storage/datastore/adapter/ProviderAdapterDiskOffering.java
|
||
} | ||
if (hiddenDiskOffering.getState() != null) { | ||
this.state = State.valueOf(hiddenDiskOffering.getState().toString()); | ||
|
@@ -166,7 +166,7 @@ | |
} | ||
|
||
enum DiskCacheMode { | ||
NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"); | ||
HYPERVISOR_DEFAULT("hypervisor_default"), NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"); | ||
Check warning on line 169 in plugins/storage/volume/adaptive/src/main/java/org/apache/cloudstack/storage/datastore/adapter/ProviderAdapterDiskOffering.java
|
||
Comment on lines
168
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have this enum multiple times? Maybe we could extract it to a common place? |
||
|
||
private final String _diskCacheMode; | ||
|
||
|
@@ -179,13 +179,15 @@ | |
return _diskCacheMode; | ||
} | ||
|
||
public static DiskCacheMode getDiskCasehMode(String cacheMode) { | ||
public static DiskCacheMode getDiskCacheMode(String cacheMode) { | ||
if (cacheMode.equals(NONE._diskCacheMode)) { | ||
return NONE; | ||
} else if (cacheMode.equals(WRITEBACK._diskCacheMode)) { | ||
return WRITEBACK; | ||
} else if (cacheMode.equals(WRITETHROUGH._diskCacheMode)) { | ||
return WRITETHROUGH; | ||
} else if (cacheMode.equals(HYPERVISOR_DEFAULT._diskCacheMode)) { | ||
return HYPERVISOR_DEFAULT; | ||
Check warning on line 190 in plugins/storage/volume/adaptive/src/main/java/org/apache/cloudstack/storage/datastore/adapter/ProviderAdapterDiskOffering.java
|
||
} else { | ||
throw new NotImplementedException("Invalid cache mode specified: " + cacheMode); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although there shouldn't be any issue with changing the order of the enum. I would put the new value at the end of the order.