use of com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand in project cosmic by MissionCriticalCloud.
the class UploadMonitorImpl method cleanupStorage.
public void cleanupStorage() {
final int EXTRACT_URL_LIFE_LIMIT_IN_SECONDS = _urlExpirationInterval;
final List<UploadVO> extractJobs = _uploadDao.listByModeAndStatus(Mode.HTTP_DOWNLOAD, Status.DOWNLOAD_URL_CREATED);
for (final UploadVO extractJob : extractJobs) {
if (getTimeDiff(extractJob.getLastUpdated()) > EXTRACT_URL_LIFE_LIMIT_IN_SECONDS) {
final String path = extractJob.getInstallPath();
final DataStore secStore = storeMgr.getDataStore(extractJob.getDataStoreId(), DataStoreRole.Image);
// Would delete the symlink for the Type and if Type == VOLUME then also the volume
final DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path, extractJob.getType(), extractJob.getUploadUrl(), ((ImageStoreVO) secStore).getParent());
final EndPoint ep = _epSelector.select(secStore);
if (ep == null) {
s_logger.warn("UploadMonitor cleanup: There is no secondary storage VM for secondary storage host " + extractJob.getDataStoreId());
// TODO: why continue? why not break?
continue;
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("UploadMonitor cleanup: Sending deletion of extract URL " + extractJob.getUploadUrl() + " to ssvm " + ep.getHostAddr());
}
final Answer ans = ep.sendMessage(cmd);
if (ans != null && ans.getResult()) {
_uploadDao.remove(extractJob.getId());
} else {
s_logger.warn("UploadMonitor cleanup: Unable to delete the link for " + extractJob.getType() + " id=" + extractJob.getTypeId() + " url=" + extractJob.getUploadUrl() + " on ssvm " + ep.getHostAddr());
}
}
}
}
use of com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand in project cloudstack by apache.
the class UploadMonitorImpl method cleanupStorage.
public void cleanupStorage() {
final int EXTRACT_URL_LIFE_LIMIT_IN_SECONDS = _urlExpirationInterval;
List<UploadVO> extractJobs = _uploadDao.listByModeAndStatus(Mode.HTTP_DOWNLOAD, Status.DOWNLOAD_URL_CREATED);
for (UploadVO extractJob : extractJobs) {
if (getTimeDiff(extractJob.getLastUpdated()) > EXTRACT_URL_LIFE_LIMIT_IN_SECONDS) {
String path = extractJob.getInstallPath();
DataStore secStore = storeMgr.getDataStore(extractJob.getDataStoreId(), DataStoreRole.Image);
// Would delete the symlink for the Type and if Type == VOLUME then also the volume
DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(path, extractJob.getType(), extractJob.getUploadUrl(), ((ImageStoreVO) secStore).getParent());
EndPoint ep = _epSelector.select(secStore);
if (ep == null) {
s_logger.warn("UploadMonitor cleanup: There is no secondary storage VM for secondary storage host " + extractJob.getDataStoreId());
// TODO: why continue? why not break?
continue;
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("UploadMonitor cleanup: Sending deletion of extract URL " + extractJob.getUploadUrl() + " to ssvm " + ep.getHostAddr());
}
Answer ans = ep.sendMessage(cmd);
if (ans != null && ans.getResult()) {
_uploadDao.remove(extractJob.getId());
} else {
s_logger.warn("UploadMonitor cleanup: Unable to delete the link for " + extractJob.getType() + " id=" + extractJob.getTypeId() + " url=" + extractJob.getUploadUrl() + " on ssvm " + ep.getHostAddr());
}
}
}
}
use of com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand in project cloudstack by apache.
the class CloudStackImageStoreDriverImpl method deleteEntityExtractUrl.
@Override
public void deleteEntityExtractUrl(DataStore store, String installPath, String downloadUrl, Upload.Type entityType) {
// find an endpoint to send command based on the ssvm on which the url was created.
EndPoint ep = _epSelector.select(store, downloadUrl);
// Delete Symlink at ssvm. In case of volume also delete the volume.
DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(installPath, entityType, downloadUrl, ((ImageStoreEntity) store).getMountPoint());
Answer ans = null;
if (ep == null) {
String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
s_logger.error(errMsg);
ans = new Answer(cmd, false, errMsg);
} else {
ans = ep.sendMessage(cmd);
}
if (ans == null || !ans.getResult()) {
String errorString = "Unable to delete the url " + downloadUrl + " for path " + installPath + " on ssvm, " + ans.getDetails();
s_logger.error(errorString);
throw new CloudRuntimeException(errorString);
}
}
use of com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand in project cosmic by MissionCriticalCloud.
the class CloudStackImageStoreDriverImpl method deleteEntityExtractUrl.
@Override
public void deleteEntityExtractUrl(final DataStore store, final String installPath, final String downloadUrl, final Upload.Type entityType) {
// find an endpoint to send command based on the ssvm on which the url was created.
final EndPoint ep = _epSelector.select(store, downloadUrl);
// Delete Symlink at ssvm. In case of volume also delete the volume.
final DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(installPath, entityType, downloadUrl, ((ImageStoreEntity) store).getMountPoint());
Answer ans = null;
if (ep == null) {
final String errMsg = "No remote endpoint to send command, check if host or ssvm is down?";
s_logger.error(errMsg);
ans = new Answer(cmd, false, errMsg);
} else {
ans = ep.sendMessage(cmd);
}
if (ans == null || !ans.getResult()) {
final String errorString = "Unable to delete the url " + downloadUrl + " for path " + installPath + " on ssvm, " + ans.getDetails();
s_logger.error(errorString);
throw new CloudRuntimeException(errorString);
}
}
Aggregations