Skip to content

Commit 4c9bca6

Browse files
committed
Remove background task to upload certificates
1 parent 47dd186 commit 4c9bca6

15 files changed

Lines changed: 24 additions & 583 deletions

File tree

api/src/org/apache/cloudstack/api/command/admin/direct/download/UploadTemplateDirectDownloadCertificateCmd.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.apache.cloudstack.api.ServerApiException;
2525
import org.apache.cloudstack.api.ApiErrorCode;
2626
import org.apache.cloudstack.api.response.SuccessResponse;
27-
import org.apache.cloudstack.api.response.ZoneResponse;
2827
import org.apache.cloudstack.context.CallContext;
2928
import org.apache.cloudstack.direct.download.DirectDownloadManager;
3029
import org.apache.log4j.Logger;
@@ -35,7 +34,7 @@
3534
description = "Upload a certificate for HTTPS direct template download on KVM hosts",
3635
responseObject = SuccessResponse.class,
3736
requestHasSensitiveInfo = true,
38-
responseHasSensitiveInfo = false,
37+
responseHasSensitiveInfo = true,
3938
since = "4.11.0",
4039
authorized = {RoleType.Admin})
4140
public class UploadTemplateDirectDownloadCertificateCmd extends BaseCmd {
@@ -57,23 +56,15 @@ public class UploadTemplateDirectDownloadCertificateCmd extends BaseCmd {
5756
@Parameter(name = ApiConstants.HYPERVISOR, type = BaseCmd.CommandType.STRING, required = true, description = "Hypervisor type")
5857
private String hypervisor;
5958

60-
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
61-
description = "Zone to upload certificate", required = true)
62-
private Long zoneId;
63-
6459
@Override
6560
public void execute() {
6661
if (!hypervisor.equalsIgnoreCase("kvm")) {
6762
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Currently supporting KVM hosts only");
6863
}
6964

70-
if (name.equalsIgnoreCase("cloud")) {
71-
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Please provide a different alias name for the certificate");
72-
}
73-
7465
try {
7566
LOG.debug("Uploading certificate " + name + " to agents for Direct Download");
76-
boolean result = directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor, zoneId);
67+
boolean result = directDownloadManager.uploadCertificateToHosts(certificate, name, hypervisor);
7768
SuccessResponse response = new SuccessResponse(getCommandName());
7869
response.setSuccess(result);
7970
setResponseObject(response);

api/src/org/apache/cloudstack/direct/download/DirectDownloadCertificate.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

api/src/org/apache/cloudstack/direct/download/DirectDownloadManager.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@
1919

2020
import com.cloud.utils.component.PluggableService;
2121
import org.apache.cloudstack.framework.agent.direct.download.DirectDownloadService;
22-
import org.apache.cloudstack.framework.config.ConfigKey;
23-
import org.apache.cloudstack.framework.config.Configurable;
2422

25-
public interface DirectDownloadManager extends DirectDownloadService, PluggableService, Configurable {
23+
public interface DirectDownloadManager extends DirectDownloadService, PluggableService {
2624

27-
ConfigKey<Long> DirectDownloadCertificateUploadInterval = new ConfigKey<>("Advanced", Long.class,
28-
"direct.download.certificate.background.task.interval",
29-
"24",
30-
"The Direct Download framework background interval in hours.",
31-
true);
3225
}

engine/schema/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,4 @@
356356
<bean id="outOfBandManagementDaoImpl" class="org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDaoImpl" />
357357
<bean id="GuestOsDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.GuestOsDetailsDaoImpl" />
358358
<bean id="annotationDaoImpl" class="org.apache.cloudstack.annotation.dao.AnnotationDaoImpl" />
359-
<bean id="directDownloadCertificateDaoImpl" class="org.apache.cloudstack.direct.download.DirectDownloadCertificateDaoImpl" />
360-
<bean id="directDownloadCertificateHostMapDaoImpl" class="org.apache.cloudstack.direct.download.DirectDownloadCertificateHostMapDaoImpl" />
361359
</beans>

engine/schema/resources/META-INF/db/schema-41120to41130.sql

Lines changed: 0 additions & 44 deletions
This file was deleted.

engine/schema/src/com/cloud/host/dao/HostDao.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,4 @@ public interface HostDao extends GenericDao<HostVO, Long>, StateDao<Status, Stat
107107
* Side note: this method is currently only used in XenServerGuru; therefore, it was designed to meet XenServer deployment scenarios requirements.
108108
*/
109109
HostVO findHostInZoneToExecuteCommand(long zoneId, HypervisorType hypervisorType);
110-
111-
List<HostVO> listAllHostsUpByZoneAndHypervisor(long zoneId, HypervisorType hypervisorType);
112110
}

engine/schema/src/com/cloud/host/dao/HostDaoImpl.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.Map;
2727
import java.util.Objects;
2828
import java.util.TimeZone;
29-
import java.util.stream.Collectors;
3029

3130
import javax.annotation.PostConstruct;
3231
import javax.inject.Inject;
@@ -1193,15 +1192,6 @@ public HostVO findHostInZoneToExecuteCommand(long zoneId, HypervisorType hypervi
11931192
}
11941193
}
11951194

1196-
@Override
1197-
public List<HostVO> listAllHostsUpByZoneAndHypervisor(long zoneId, HypervisorType hypervisorType) {
1198-
return listByDataCenterIdAndHypervisorType(zoneId, hypervisorType)
1199-
.stream()
1200-
.filter(x -> x.getStatus().equals(Status.Up) &&
1201-
x.getType() == Host.Type.Routing)
1202-
.collect(Collectors.toList());
1203-
}
1204-
12051195
private ResultSet executeSqlGetResultsetForMethodFindHostInZoneToExecuteCommand(HypervisorType hypervisorType, long zoneId, TransactionLegacy tx, String sql) throws SQLException {
12061196
PreparedStatement pstmt = tx.prepareAutoCloseStatement(sql);
12071197
pstmt.setString(1, Objects.toString(hypervisorType));

engine/schema/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateDao.java

Lines changed: 0 additions & 28 deletions
This file was deleted.

engine/schema/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateDaoImpl.java

Lines changed: 0 additions & 58 deletions
This file was deleted.

engine/schema/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateHostMapDao.java

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)