On 10/11/2012 03:21 PM, Ravi Nori wrote:
The storage type determines which of the two default values is
returned by BaseDisk when wipeAfterDelete is not set (is null)
StorageType storageType = StorageType.UNKNOWN;
So isWipeAfterDeleteMethodLooks like this
public boolean isWipeAfterDelete() {
if (wipeAfterDelete == null) {
return getDefaultIsWipeAfterDelete();
}
return wipeAfterDelete;
}
private boolean getDefaultIsWipeAfterDelete() {
if(storageType.equals(StorageType.UNKNOWN)) {
return false;
}
switch (storageType) {
case ISCSI:
case FCP:
return wipeAfterDeleteBlockStorageDomain;
default:
return wipeAfterDeleteFileStorageDomain;
}
}
Ravi,
Is there any reason for not doing all this ^ in .ctr?
i.e iiuc wipeAfterDelete became an reference type, so you can
see if it was not set even in parameters .ctr and apply your
logic there.
(this way setter/s won't have to carry any logic)
There is a new method isWipeAfterDeleteSet that will be used by
commands to set the storage type to get the default wipeAfterDeleteFlag if wipeAfterDelete
was not set.
public boolean isWipeAfterDeleteSet() {
return wipeAfterDelete != null;
}
--
Michael Pasternak
RedHat, ENG-Virtualization R&D