Repository: airavata Updated Branches: refs/heads/AIRAVATA-2500 83253df71 -> 316656c35
AIRAVATA-2500 Persist SSH account provisioner and config Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d66b4bfa Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d66b4bfa Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d66b4bfa Branch: refs/heads/AIRAVATA-2500 Commit: d66b4bfac83c1ec5b68f9f28bd464f95f1a8413a Parents: 83253df Author: Marcus Christie <[email protected]> Authored: Fri Sep 1 12:33:40 2017 -0400 Committer: Marcus Christie <[email protected]> Committed: Fri Sep 1 12:33:40 2017 -0400 ---------------------------------------------------------------------- .../accountprovisioning/SSHAccountManager.java | 5 +- .../catalog/impl/GwyResourceProfileImpl.java | 10 ++ .../model/ComputeResourcePreference.java | 31 +++++-- .../SSHAccountProvisionerConfiguration.java | 98 ++++++++++++++++++++ .../SSHAccountProvisionerConfigurationPK.java | 57 ++++++++++++ .../ComputeHostPreferenceResource.java | 50 +++++++--- .../app/catalog/util/AppCatalogJPAUtils.java | 8 ++ .../util/AppCatalogThriftConversion.java | 8 +- .../src/main/resources/META-INF/persistence.xml | 1 + .../src/main/resources/appcatalog-derby.sql | 11 +++ .../src/main/resources/appcatalog-mysql.sql | 13 ++- .../DeltaScripts/appCatalog_schema_delta.sql | 31 +++++++ .../gateway_resource_profile_model.thrift | 2 +- 13 files changed, 300 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java ---------------------------------------------------------------------- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index f9ed22a..74c0dd2 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -25,7 +25,6 @@ import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.credential.store.client.CredentialStoreClientFactory; import org.apache.airavata.credential.store.cpi.CredentialStoreService; import org.apache.airavata.credential.store.exception.CredentialStoreException; -import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam; import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; @@ -181,11 +180,11 @@ public class SSHAccountManager { } } - private static Map<ConfigParam, String> convertConfigParams(String provisionerName, Map<SSHAccountProvisionerConfigParam, String> thriftConfigParams) { + private static Map<ConfigParam, String> convertConfigParams(String provisionerName, Map<String, String> thriftConfigParams) { List<ConfigParam> configParams = SSHAccountProvisionerFactory.getSSHAccountProvisionerConfigParams(provisionerName); Map<String, ConfigParam> configParamMap = configParams.stream().collect(Collectors.toMap(ConfigParam::getName, Function.identity())); - return thriftConfigParams.entrySet().stream().collect(Collectors.toMap(entry -> configParamMap.get(entry.getKey().getName()), entry -> entry.getValue())); + return thriftConfigParams.entrySet().stream().collect(Collectors.toMap(entry -> configParamMap.get(entry.getKey()), entry -> entry.getValue())); } private static RegistryService.Client getRegistryServiceClient() { http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java index ccfb08a..78a6f0f 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java @@ -89,6 +89,11 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { if (preference.getReservationEndTime() > 0) { resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime())); } + resource.setSshAccountProvisioner(preference.getSshAccountProvisioner()); + if (preference.getSshAccountProvisionerConfig() != null && !preference.getSshAccountProvisionerConfig().isEmpty()) { + Map<String,String> sshAccountProvisionerConfigurationsCopy = new HashMap<>(preference.getSshAccountProvisionerConfig()); + resource.setSshAccountProvisionerConfigurations(sshAccountProvisionerConfigurationsCopy); + } resource.save(); } } @@ -154,6 +159,11 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { if (preference.getReservationEndTime() > 0) { resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime())); } + resource.setSshAccountProvisioner(preference.getSshAccountProvisioner()); + if (preference.getSshAccountProvisionerConfig() != null && !preference.getSshAccountProvisionerConfig().isEmpty()) { + Map<String,String> sshAccountProvisionerConfigurationsCopy = new HashMap<>(preference.getSshAccountProvisionerConfig()); + resource.setSshAccountProvisionerConfigurations(sshAccountProvisionerConfigurationsCopy); + } resource.save(); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java index a289526..20f55d4 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java @@ -20,15 +20,9 @@ package org.apache.airavata.registry.core.app.catalog.model; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; +import javax.persistence.*; import java.sql.Timestamp; +import java.util.Collection; @Entity @Table(name = "COMPUTE_RESOURCE_PREFERENCE") @@ -66,6 +60,8 @@ public class ComputeResourcePreference { private Timestamp reservationStartTime; @Column(name = "RESERVATION_END_TIME") private Timestamp reservationEndTime; + @Column(name = "SSH_ACCOUNT_PROVISIONER") + private String sshAccountProvisioner; @ManyToOne(cascade= CascadeType.MERGE) @@ -76,6 +72,9 @@ public class ComputeResourcePreference { @JoinColumn(name = "GATEWAY_ID") private GatewayProfile gatewayProfile; + @OneToMany(mappedBy = "computeResourcePreference", cascade = CascadeType.ALL, orphanRemoval = true) + Collection<SSHAccountProvisionerConfiguration> sshAccountProvisionerConfigurations; + public String getGatewayId() { return gatewayId; @@ -212,4 +211,20 @@ public class ComputeResourcePreference { public void setReservationEndTime(Timestamp reservationEndTime) { this.reservationEndTime = reservationEndTime; } + + public String getSshAccountProvisioner() { + return sshAccountProvisioner; + } + + public void setSshAccountProvisioner(String sshAccountProvisioner) { + this.sshAccountProvisioner = sshAccountProvisioner; + } + + public Collection<SSHAccountProvisionerConfiguration> getSshAccountProvisionerConfigurations() { + return sshAccountProvisionerConfigurations; + } + + public void setSshAccountProvisionerConfigurations(Collection<SSHAccountProvisionerConfiguration> sshAccountProvisionerConfigurations) { + this.sshAccountProvisionerConfigurations = sshAccountProvisionerConfigurations; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfiguration.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfiguration.java new file mode 100644 index 0000000..303835b --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfiguration.java @@ -0,0 +1,98 @@ +/* + * 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.airavata.registry.core.app.catalog.model; + +import javax.persistence.*; + +@Entity +@Table(name = "SSH_ACCOUNT_PROVISIONER_CONFIG") +@IdClass(SSHAccountProvisionerConfigurationPK.class) +public class SSHAccountProvisionerConfiguration { + @Id + @Column(name = "GATEWAY_ID") + private String gatewayId; + @Id + @Column(name = "RESOURCE_ID") + private String resourceId; + @Id + @Column(name = "CONFIG_NAME") + private String configName; + + @Column(name = "CONFIG_VALUE") + private String configValue; + + @ManyToOne + @JoinColumns({ + @JoinColumn(name = "GATEWAY_ID", referencedColumnName = "GATEWAY_ID", nullable = false), + @JoinColumn(name = "RESOURCE_ID", referencedColumnName = "RESOURCE_ID", nullable = false) + }) + private ComputeResourcePreference computeResourcePreference; + + public SSHAccountProvisionerConfiguration() {} + + public SSHAccountProvisionerConfiguration(String configName, String configValue, ComputeResourcePreference computeResourcePreference) { + this.gatewayId = computeResourcePreference.getGatewayId(); + this.resourceId = computeResourcePreference.getResourceId(); + this.configName = configName; + this.configValue = configValue; + this.computeResourcePreference = computeResourcePreference; + } + + public String getGatewayId() { + return gatewayId; + } + + public void setGatewayId(String gatewayId) { + this.gatewayId = gatewayId; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getConfigName() { + return configName; + } + + public void setConfigName(String configName) { + this.configName = configName; + } + + public String getConfigValue() { + return configValue; + } + + public void setConfigValue(String configValue) { + this.configValue = configValue; + } + + public ComputeResourcePreference getComputeResourcePreference() { + return computeResourcePreference; + } + + public void setComputeResourcePreference(ComputeResourcePreference computeResourcePreference) { + this.computeResourcePreference = computeResourcePreference; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfigurationPK.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfigurationPK.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfigurationPK.java new file mode 100644 index 0000000..94045b0 --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/SSHAccountProvisionerConfigurationPK.java @@ -0,0 +1,57 @@ +/* + * 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.airavata.registry.core.app.catalog.model; + +import java.io.Serializable; + +public class SSHAccountProvisionerConfigurationPK implements Serializable { + private String gatewayId; + private String resourceId; + private String configName; + + public SSHAccountProvisionerConfigurationPK(String gatewayId, String resourceId, String configName) { + this.gatewayId = gatewayId; + this.resourceId = resourceId; + this.configName = configName; + } + + public SSHAccountProvisionerConfigurationPK() {} + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof SSHAccountProvisionerConfigurationPK)) return false; + + SSHAccountProvisionerConfigurationPK that = (SSHAccountProvisionerConfigurationPK) o; + + if (!gatewayId.equals(that.gatewayId)) return false; + if (!resourceId.equals(that.resourceId)) return false; + return configName.equals(that.configName); + } + + @Override + public int hashCode() { + int result = gatewayId.hashCode(); + result = 31 * result + resourceId.hashCode(); + result = 31 * result + configName.hashCode(); + return result; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java index 29c2d5a..1320025 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeHostPreferenceResource.java @@ -20,10 +20,7 @@ package org.apache.airavata.registry.core.app.catalog.resources; import org.apache.airavata.common.exception.ApplicationSettingsException; -import org.apache.airavata.registry.core.app.catalog.model.ComputeResource; -import org.apache.airavata.registry.core.app.catalog.model.ComputeResourcePreference; -import org.apache.airavata.registry.core.app.catalog.model.ComputeResourcePreferencePK; -import org.apache.airavata.registry.core.app.catalog.model.GatewayProfile; +import org.apache.airavata.registry.core.app.catalog.model.*; import org.apache.airavata.registry.core.app.catalog.util.AppCatalogJPAUtils; import org.apache.airavata.registry.core.app.catalog.util.AppCatalogQueryGenerator; import org.apache.airavata.registry.core.app.catalog.util.AppCatalogResourceType; @@ -56,6 +53,8 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { private String reservation; private Timestamp reservationStartTime; private Timestamp reservationEndTime; + private String sshAccountProvisioner; + private Map<String,String> sshAccountProvisionerConfigurations; private GatewayProfileResource gatewayProfile; private ComputeResourceResource computeHostResource; @@ -200,6 +199,22 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { this.reservationEndTime = reservationEndTime; } + public String getSshAccountProvisioner() { + return sshAccountProvisioner; + } + + public void setSshAccountProvisioner(String sshAccountProvisioner) { + this.sshAccountProvisioner = sshAccountProvisioner; + } + + public Map<String, String> getSshAccountProvisionerConfigurations() { + return sshAccountProvisionerConfigurations; + } + + public void setSshAccountProvisionerConfigurations(Map<String, String> sshAccountProvisionerConfigurations) { + this.sshAccountProvisionerConfigurations = sshAccountProvisionerConfigurations; + } + @Override public void remove(Object identifier) throws AppCatalogException { HashMap<String, String> ids; @@ -408,14 +423,7 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { try { em = AppCatalogJPAUtils.getEntityManager(); ComputeResourcePreference existingPreference = em.find(ComputeResourcePreference.class, new ComputeResourcePreferencePK(gatewayId, resourceId)); - if (em.isOpen()) { - if (em.getTransaction().isActive()){ - em.getTransaction().rollback(); - } - em.close(); - } - em = AppCatalogJPAUtils.getEntityManager(); em.getTransaction().begin(); ComputeResource computeResource = em.find(ComputeResource.class, resourceId); GatewayProfile gatewayProf = em.find(GatewayProfile.class, gatewayId); @@ -437,6 +445,17 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { existingPreference.setReservation(reservation); existingPreference.setReservationStartTime(reservationStartTime); existingPreference.setReservationEndTime(reservationEndTime); + existingPreference.setSshAccountProvisioner(sshAccountProvisioner); + if (sshAccountProvisionerConfigurations != null && !sshAccountProvisionerConfigurations.isEmpty()) { + List<SSHAccountProvisionerConfiguration> configurations = new ArrayList<>(); + for (String sshAccountProvisionerConfigName : sshAccountProvisionerConfigurations.keySet()) { + String value = sshAccountProvisionerConfigurations.get(sshAccountProvisionerConfigName); + configurations.add(new SSHAccountProvisionerConfiguration(sshAccountProvisionerConfigName, value, existingPreference)); + } + existingPreference.setSshAccountProvisionerConfigurations(configurations); + } else { + existingPreference.setSshAccountProvisionerConfigurations(null); + } em.merge(existingPreference); } else { ComputeResourcePreference resourcePreference = new ComputeResourcePreference(); @@ -457,6 +476,15 @@ public class ComputeHostPreferenceResource extends AppCatAbstractResource { resourcePreference.setReservation(reservation); resourcePreference.setReservationStartTime(reservationStartTime); resourcePreference.setReservationEndTime(reservationEndTime); + existingPreference.setSshAccountProvisioner(sshAccountProvisioner); + if (sshAccountProvisionerConfigurations != null && !sshAccountProvisionerConfigurations.isEmpty()){ + List<SSHAccountProvisionerConfiguration> configurations = new ArrayList<>(); + for (String sshAccountProvisionerConfigName : sshAccountProvisionerConfigurations.keySet()) { + String value = sshAccountProvisionerConfigurations.get(sshAccountProvisionerConfigName); + configurations.add(new SSHAccountProvisionerConfiguration(sshAccountProvisionerConfigName, value, existingPreference)); + } + existingPreference.setSshAccountProvisionerConfigurations(configurations); + } em.persist(resourcePreference); } em.getTransaction().commit(); http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java index 099c088..f794078 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java @@ -957,6 +957,14 @@ public class AppCatalogJPAUtils { resource.setReservation(o.getReservation()); resource.setReservationStartTime(o.getReservationStartTime()); resource.setReservationEndTime(o.getReservationEndTime()); + resource.setSshAccountProvisioner(o.getSshAccountProvisioner()); + if (o.getSshAccountProvisionerConfigurations() != null && !o.getSshAccountProvisionerConfigurations().isEmpty()) { + Map<String,String> sshAccountProvisionerConfigurations = new HashMap<>(); + for (SSHAccountProvisionerConfiguration config : o.getSshAccountProvisionerConfigurations()){ + sshAccountProvisionerConfigurations.put(config.getConfigName(), config.getConfigValue()); + } + resource.setSshAccountProvisionerConfigurations(sshAccountProvisionerConfigurations); + } } return resource; } http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java index acfc16e..1a85454 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java @@ -30,8 +30,8 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfil import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference; import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription; import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference; -import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference; import org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile; +import org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference; import org.apache.airavata.model.application.io.DataType; import org.apache.airavata.model.application.io.InputDataObjectType; import org.apache.airavata.model.application.io.OutputDataObjectType; @@ -43,6 +43,7 @@ import org.apache.airavata.registry.cpi.AppCatalogException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; public class AppCatalogThriftConversion { public static ComputeResourceResource getComputeHostResource (ComputeResourceDescription description){ @@ -874,6 +875,11 @@ public class AppCatalogThriftConversion { if (resource.getReservationEndTime() != null) { preference.setReservationEndTime(resource.getReservationEndTime().getTime()); } + preference.setSshAccountProvisioner(resource.getSshAccountProvisioner()); + if (resource.getSshAccountProvisionerConfigurations() != null && !resource.getSshAccountProvisionerConfigurations().isEmpty()){ + Map<String, String> sshAccountProvisionerConfigCopy = new HashMap<>(resource.getSshAccountProvisionerConfigurations()); + preference.setSshAccountProvisionerConfig(sshAccountProvisionerConfigCopy); + } return preference; } http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml index c3f1a0f..5ac231f 100644 --- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml +++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml @@ -51,6 +51,7 @@ <class>org.apache.airavata.registry.core.app.catalog.model.ApplicationIntOutput</class> <class>org.apache.airavata.registry.core.app.catalog.model.GatewayProfile</class> <class>org.apache.airavata.registry.core.app.catalog.model.ComputeResourcePreference</class> + <class>org.apache.airavata.registry.core.app.catalog.model.SSHAccountProvisionerConfiguration</class> <class>org.apache.airavata.registry.core.app.catalog.model.UserResourceProfile</class> <class>org.apache.airavata.registry.core.app.catalog.model.UserComputeResourcePreference</class> <class>org.apache.airavata.registry.core.app.catalog.model.UserStoragePreference</class> http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql index 68fd1ff..df4ebb1 100644 --- a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql +++ b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql @@ -356,11 +356,22 @@ CREATE TABLE COMPUTE_RESOURCE_PREFERENCE RESERVATION VARCHAR (255), RESERVATION_START_TIME timestamp, RESERVATION_END_TIME timestamp, + SSH_ACCOUNT_PROVISIONER VARCHAR(255), PRIMARY KEY(GATEWAY_ID,RESOURCE_ID), FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE ); +CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG +( + GATEWAY_ID VARCHAR(255), + RESOURCE_ID VARCHAR(255), + CONFIG_NAME VARCHAR(255), + CONFIG_VALUE VARCHAR(255), + PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME), + FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE +); + CREATE TABLE BATCH_QUEUE ( COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL, http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql index 997bb2d..54886b1 100644 --- a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql +++ b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql @@ -355,10 +355,21 @@ CREATE TABLE COMPUTE_RESOURCE_PREFERENCE RESERVATION VARCHAR (255), RESERVATION_START_TIME timestamp, RESERVATION_END_TIME timestamp, + SSH_ACCOUNT_PROVISIONER VARCHAR(255), PRIMARY KEY(GATEWAY_ID,RESOURCE_ID), FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE, FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE -); +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG +( + GATEWAY_ID VARCHAR(255), + RESOURCE_ID VARCHAR(255), + CONFIG_NAME VARCHAR(255), + CONFIG_VALUE VARCHAR(255), + PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME), + FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; CREATE TABLE BATCH_QUEUE ( http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql ---------------------------------------------------------------------- diff --git a/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql b/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql new file mode 100644 index 0000000..bf31b6b --- /dev/null +++ b/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql @@ -0,0 +1,31 @@ +-- +-- +-- 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. +-- + +alter table COMPUTE_RESOURCE_PREFERENCE add SSH_ACCOUNT_PROVISIONER VARCHAR(255); + +CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG +( + GATEWAY_ID VARCHAR(255), + RESOURCE_ID VARCHAR(255), + CONFIG_NAME VARCHAR(255), + CONFIG_VALUE VARCHAR(255), + PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME), + FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE +) ENGINE=MyISAM DEFAULT CHARSET=latin1; http://git-wip-us.apache.org/repos/asf/airavata/blob/d66b4bfa/thrift-interface-descriptions/data-models/resource-catalog-models/gateway_resource_profile_model.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/data-models/resource-catalog-models/gateway_resource_profile_model.thrift b/thrift-interface-descriptions/data-models/resource-catalog-models/gateway_resource_profile_model.thrift index 060442b..87ca433 100644 --- a/thrift-interface-descriptions/data-models/resource-catalog-models/gateway_resource_profile_model.thrift +++ b/thrift-interface-descriptions/data-models/resource-catalog-models/gateway_resource_profile_model.thrift @@ -77,7 +77,7 @@ struct ComputeResourcePreference { 13: optional i64 reservationStartTime, 14: optional i64 reservationEndTime, 15: optional string sshAccountProvisioner, - 16: optional map<account_provisioning_model.SSHAccountProvisionerConfigParam, string> sshAccountProvisionerConfig + 16: optional map<string, string> sshAccountProvisionerConfig } struct StoragePreference {
