Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent regenerating keystore and add background task to upload certi…
…ficates
- Loading branch information
Showing
18 changed files
with
628 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
api/src/org/apache/cloudstack/direct/download/DirectDownloadCertificate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
package org.apache.cloudstack.direct.download; | ||
|
||
import com.cloud.hypervisor.Hypervisor; | ||
import org.apache.cloudstack.api.Identity; | ||
import org.apache.cloudstack.api.InternalIdentity; | ||
|
||
public interface DirectDownloadCertificate extends InternalIdentity, Identity { | ||
|
||
String getCertificate(); | ||
String getAlias(); | ||
Hypervisor.HypervisorType getHypervisorType(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
engine/schema/resources/META-INF/db/schema-41120to41130.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- Licensed to the Apache Software Foundation (ASF) under one | ||
-- or more contributor license agreements. See the NOTICE file | ||
-- distributed with this work for additional information | ||
-- regarding copyright ownership. The ASF licenses this file | ||
-- to you under the Apache License, Version 2.0 (the | ||
-- "License"); you may not use this file except in compliance | ||
-- with the License. You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, | ||
-- software distributed under the License is distributed on an | ||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
-- KIND, either express or implied. See the License for the | ||
-- specific language governing permissions and limitations | ||
-- under the License. | ||
|
||
--; | ||
-- Schema upgrade from 4.11.2.0 to 4.11.3.0 | ||
--; | ||
|
||
CREATE TABLE `cloud`.`direct_download_certificate` ( | ||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | ||
`uuid` varchar(40) NOT NULL, | ||
`alias` varchar(255) NOT NULL, | ||
`certificate` text NOT NULL, | ||
`hypervisor_type` varchar(45) NOT NULL, | ||
`zone_id` bigint(20) unsigned NOT NULL, | ||
PRIMARY KEY (`id`), | ||
KEY `i_direct_download_certificate_alias` (`alias`), | ||
KEY `fk_direct_download_certificate__zone_id` (`zone_id`), | ||
CONSTRAINT `fk_direct_download_certificate__zone_id` FOREIGN KEY (`zone_id`) REFERENCES `data_center` (`id`) ON DELETE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
||
CREATE TABLE `cloud`.`direct_download_certificate_host_map` ( | ||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | ||
`certificate_id` bigint(20) unsigned NOT NULL, | ||
`host_id` bigint(20) unsigned NOT NULL, | ||
PRIMARY KEY (`id`), | ||
KEY `fk_direct_download_certificate_host_map__host_id` (`host_id`), | ||
KEY `fk_direct_download_certificate_host_map__certificate_id` (`certificate_id`), | ||
CONSTRAINT `fk_direct_download_certificate_host_map__host_id` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE CASCADE, | ||
CONSTRAINT `fk_direct_download_certificate_host_map__certificate_id` FOREIGN KEY (`certificate_id`) REFERENCES `direct_download_certificate` (`id`) ON DELETE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
engine/schema/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
package org.apache.cloudstack.direct.download; | ||
|
||
import com.cloud.hypervisor.Hypervisor; | ||
import com.cloud.utils.db.GenericDao; | ||
|
||
import java.util.List; | ||
|
||
public interface DirectDownloadCertificateDao extends GenericDao<DirectDownloadCertificateVO, Long> { | ||
DirectDownloadCertificateVO findByAlias(String alias); | ||
List<DirectDownloadCertificateVO> listByHypervisorType(Hypervisor.HypervisorType hypervisorType); | ||
List<DirectDownloadCertificateVO> listByZone(long zoneId); | ||
} |
58 changes: 58 additions & 0 deletions
58
...ne/schema/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateDaoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
package org.apache.cloudstack.direct.download; | ||
|
||
import com.cloud.hypervisor.Hypervisor; | ||
import com.cloud.utils.db.GenericDaoBase; | ||
import com.cloud.utils.db.SearchBuilder; | ||
import com.cloud.utils.db.SearchCriteria; | ||
|
||
import java.util.List; | ||
|
||
public class DirectDownloadCertificateDaoImpl extends GenericDaoBase<DirectDownloadCertificateVO, Long> implements DirectDownloadCertificateDao { | ||
|
||
private final SearchBuilder<DirectDownloadCertificateVO> certificateSearchBuilder; | ||
|
||
public DirectDownloadCertificateDaoImpl() { | ||
certificateSearchBuilder = createSearchBuilder(); | ||
certificateSearchBuilder.and("alias", certificateSearchBuilder.entity().getAlias(), SearchCriteria.Op.EQ); | ||
certificateSearchBuilder.and("hypervisor_type", certificateSearchBuilder.entity().getHypervisorType(), SearchCriteria.Op.EQ); | ||
certificateSearchBuilder.and("zone_id", certificateSearchBuilder.entity().getZoneId(), SearchCriteria.Op.EQ); | ||
certificateSearchBuilder.done(); | ||
} | ||
|
||
@Override | ||
public DirectDownloadCertificateVO findByAlias(String alias) { | ||
SearchCriteria<DirectDownloadCertificateVO> sc = certificateSearchBuilder.create(); | ||
sc.setParameters("alias", alias); | ||
return findOneBy(sc); | ||
} | ||
|
||
@Override | ||
public List<DirectDownloadCertificateVO> listByHypervisorType(Hypervisor.HypervisorType hypervisorType) { | ||
SearchCriteria<DirectDownloadCertificateVO> sc = certificateSearchBuilder.create(); | ||
sc.setParameters("hypervisor_type", hypervisorType); | ||
return listBy(sc); | ||
} | ||
|
||
@Override | ||
public List<DirectDownloadCertificateVO> listByZone(long zoneId) { | ||
SearchCriteria<DirectDownloadCertificateVO> sc = certificateSearchBuilder.create(); | ||
sc.setParameters("zone_id", zoneId); | ||
return listBy(sc); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...schema/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateHostMapDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
package org.apache.cloudstack.direct.download; | ||
|
||
import com.cloud.utils.db.GenericDao; | ||
|
||
public interface DirectDownloadCertificateHostMapDao extends GenericDao<DirectDownloadCertificateHostMapVO, Long> { | ||
DirectDownloadCertificateHostMapVO findByCertificateAndHost(long certificateId, long hostId); | ||
} |
39 changes: 39 additions & 0 deletions
39
...ma/src/org/apache/cloudstack/direct/download/DirectDownloadCertificateHostMapDaoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
package org.apache.cloudstack.direct.download; | ||
|
||
import com.cloud.utils.db.GenericDaoBase; | ||
import com.cloud.utils.db.SearchBuilder; | ||
import com.cloud.utils.db.SearchCriteria; | ||
|
||
public class DirectDownloadCertificateHostMapDaoImpl extends GenericDaoBase<DirectDownloadCertificateHostMapVO, Long> implements DirectDownloadCertificateHostMapDao { | ||
private final SearchBuilder<DirectDownloadCertificateHostMapVO> mapSearchBuilder; | ||
|
||
public DirectDownloadCertificateHostMapDaoImpl() { | ||
mapSearchBuilder = createSearchBuilder(); | ||
mapSearchBuilder.and("certificate_id", mapSearchBuilder.entity().getCertificateId(), SearchCriteria.Op.EQ); | ||
mapSearchBuilder.and("host_id", mapSearchBuilder.entity().getHostId(), SearchCriteria.Op.EQ); | ||
mapSearchBuilder.done(); | ||
} | ||
@Override | ||
public DirectDownloadCertificateHostMapVO findByCertificateAndHost(long certificateId, long hostId) { | ||
SearchCriteria<DirectDownloadCertificateHostMapVO> sc = mapSearchBuilder.create(); | ||
sc.setParameters("certificate_id", certificateId); | ||
sc.setParameters("host_id", hostId); | ||
return findOneBy(sc); | ||
} | ||
} |
Oops, something went wrong.