long size = this.getTemplateSize(conn, templateUrl);
return new CreateObjectAnswer(cmd, templateUrl, size);
}
protected CreateObjectAnswer execute(CreateObjectCommand cmd) {
String uriString = cmd.getObjectUri();
DecodedDataObject obj = null;
Connection conn = hypervisorResource.getConnection();
VDI vdi = null;
boolean result = false;
String errorMsg = null;
try {
obj = Decoder.decode(uriString);
DecodedDataStore store = obj.getStore();
if (obj.getObjType().equalsIgnoreCase("template") && store.getRole().equalsIgnoreCase("image")) {
return getTemplateSize(cmd, obj.getPath());
}
long size = obj.getSize();
String name = obj.getName();
String storeUuid = store.getUuid();
SR primaryDataStoreSR = getSRByNameLabel(conn, storeUuid);
vdi = createVdi(conn, name, primaryDataStoreSR, size);
VDI.Record record = vdi.getRecord(conn);
result = true;