String storeUuid = store.getUuid();
SR primaryDataStoreSR = getSRByNameLabel(conn, storeUuid);
vdi = createVdi(conn, name, primaryDataStoreSR, size);
VDI.Record record = vdi.getRecord(conn);
result = true;
return new CreateObjectAnswer(cmd, record.uuid, record.virtualSize);
} catch (BadServerResponse e) {
s_logger.debug("Failed to create volume", e);
errorMsg = e.toString();
} catch (XenAPIException e) {
s_logger.debug("Failed to create volume", e);
errorMsg = e.toString();
} catch (XmlRpcException e) {
s_logger.debug("Failed to create volume", e);
errorMsg = e.toString();
} catch (URISyntaxException e) {
s_logger.debug("Failed to create volume", e);
errorMsg = e.toString();
} finally {
if (!result && vdi != null) {
try {
deleteVDI(conn, vdi);
} catch (Exception e) {
s_logger.debug("Faled to delete vdi: " + vdi.toString());
}
}
}
return new CreateObjectAnswer(cmd, false, errorMsg);
}