mirror of https://github.com/apache/cloudstack.git
Add convenient delete methods in DataObject to delete dangling data
object.
This commit is contained in:
parent
614e08e19f
commit
eb93efdaa4
|
|
@ -38,6 +38,8 @@ public interface DataObject {
|
|||
// public DiskFormat getFormat();
|
||||
public String getUuid();
|
||||
|
||||
boolean delete();
|
||||
|
||||
public void processEvent(ObjectInDataStoreStateMachine.Event event);
|
||||
|
||||
public void processEvent(ObjectInDataStoreStateMachine.Event event, Answer answer);
|
||||
|
|
|
|||
|
|
@ -125,12 +125,12 @@ public class TemplateObject implements TemplateInfo {
|
|||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* // If the template that was passed into this allocator is not
|
||||
* installed in the storage pool, // add 3 * (template size on secondary
|
||||
* storage) to the running total VMTemplateHostVO templateHostVO =
|
||||
* _storageMgr.findVmTemplateHost(templateForVmCreation.getId(), null);
|
||||
*
|
||||
*
|
||||
* if (templateHostVO == null) { VMTemplateSwiftVO templateSwiftVO =
|
||||
* _swiftMgr.findByTmpltId(templateForVmCreation.getId()); if
|
||||
* (templateSwiftVO != null) { long templateSize =
|
||||
|
|
@ -395,4 +395,13 @@ public class TemplateObject implements TemplateInfo {
|
|||
return this.imageVO.getDomainId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete() {
|
||||
if (dataStore != null) {
|
||||
return dataStore.delete(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,4 +284,11 @@ public class SnapshotObject implements SnapshotInfo {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete() {
|
||||
if (store != null) {
|
||||
return store.delete(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,8 +252,9 @@ public class PrimaryDataStoreImpl implements PrimaryDataStore {
|
|||
|
||||
@Override
|
||||
public boolean delete(DataObject obj) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
//TODO: clean up through driver
|
||||
objectInStoreMgr.delete(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -505,4 +505,12 @@ public class VolumeObject implements VolumeInfo {
|
|||
public ImageFormat getFormat() {
|
||||
return this.volumeVO.getFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete() {
|
||||
if (dataStore != null) {
|
||||
return dataStore.delete(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue