mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch '4.19'
This commit is contained in:
commit
21d107c349
@ -149,7 +149,7 @@ public interface NetworkModel {
|
||||
|
||||
boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services);
|
||||
|
||||
Network getNetworkWithSGWithFreeIPs(Long zoneId);
|
||||
Network getNetworkWithSGWithFreeIPs(Account account, Long zoneId);
|
||||
|
||||
Network getNetworkWithSecurityGroupEnabled(Long zoneId);
|
||||
|
||||
@ -360,6 +360,6 @@ public interface NetworkModel {
|
||||
|
||||
boolean isSecurityGroupSupportedForZone(Long zoneId);
|
||||
|
||||
boolean checkSecurityGroupSupportForNetwork(DataCenter zone, List<Long> networkIds,
|
||||
boolean checkSecurityGroupSupportForNetwork(Account account, DataCenter zone, List<Long> networkIds,
|
||||
List<Long> securityGroupsIds);
|
||||
}
|
||||
|
||||
@ -27,18 +27,7 @@
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.20.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>juniper-tungsten-api</id>
|
||||
<url>https://github.com/radu-todirica/tungsten-api/raw/master</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.juniper.tungsten</groupId>
|
||||
<artifactId>juniper-tungsten-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
@ -282,11 +271,6 @@
|
||||
<artifactId>cloud-plugin-network-ovs</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-tungsten</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-elb</artifactId>
|
||||
@ -1113,6 +1097,11 @@
|
||||
<artifactId>cloud-plugin-network-nsx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-tungsten</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-api-vmware-sioc</artifactId>
|
||||
|
||||
@ -83,11 +83,6 @@
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-network-tungsten</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
// 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.network.tungsten.agent.api;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class SetupTfRouteCommand extends Command {
|
||||
private final String privateIp;
|
||||
private final String publicIp;
|
||||
private final String srcNetwork;
|
||||
|
||||
public SetupTfRouteCommand(final String privateIp, final String publicIp, final String srcNetwork) {
|
||||
this.privateIp = privateIp;
|
||||
this.publicIp = publicIp;
|
||||
this.srcNetwork = srcNetwork;
|
||||
}
|
||||
|
||||
public String getPrivateIp() {
|
||||
return privateIp;
|
||||
}
|
||||
|
||||
public String getPublicIp() {
|
||||
return publicIp;
|
||||
}
|
||||
|
||||
public String getSrcNetwork() {
|
||||
return srcNetwork;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
SetupTfRouteCommand that = (SetupTfRouteCommand) o;
|
||||
return Objects.equals(privateIp, that.privateIp) && Objects.equals(publicIp, that.publicIp) && Objects.equals(srcNetwork, that.srcNetwork);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), privateIp, publicIp, srcNetwork);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
// 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.network.tungsten.agent.api;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class SetupTungstenVRouterCommand extends Command {
|
||||
private final String oper;
|
||||
private final String inf;
|
||||
private final String subnet;
|
||||
private final String route;
|
||||
private final String vrf;
|
||||
|
||||
public SetupTungstenVRouterCommand(final String oper, final String inf, final String subnet, final String route,
|
||||
final String vrf) {
|
||||
this.oper = oper;
|
||||
this.inf = inf;
|
||||
this.subnet = subnet;
|
||||
this.route = route;
|
||||
this.vrf = vrf;
|
||||
}
|
||||
|
||||
public String getOper() {
|
||||
return oper;
|
||||
}
|
||||
|
||||
public String getInf() {
|
||||
return inf;
|
||||
}
|
||||
|
||||
public String getSubnet() {
|
||||
return subnet;
|
||||
}
|
||||
|
||||
public String getRoute() {
|
||||
return route;
|
||||
}
|
||||
|
||||
public String getVrf() {
|
||||
return vrf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
SetupTungstenVRouterCommand that = (SetupTungstenVRouterCommand) o;
|
||||
return Objects.equals(oper, that.oper) && Objects.equals(inf, that.inf) && Objects.equals(subnet, that.subnet) && Objects.equals(route, that.route) && Objects.equals(vrf, that.vrf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), oper, inf, subnet, route, vrf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
// 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.network.tungsten.agent.api;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class UpdateTungstenLoadbalancerSslCommand extends Command {
|
||||
private final String lbUuid;
|
||||
private final String sslCertName;
|
||||
private final String certificateKey;
|
||||
private final String privateKey;
|
||||
private final String privateIp;
|
||||
private final String port;
|
||||
|
||||
public UpdateTungstenLoadbalancerSslCommand(final String lbUuid, final String sslCertName,
|
||||
final String certificateKey, final String privateKey, final String privateIp, final String port) {
|
||||
this.lbUuid = lbUuid;
|
||||
this.sslCertName = sslCertName;
|
||||
this.certificateKey = certificateKey;
|
||||
this.privateKey = privateKey;
|
||||
this.privateIp = privateIp;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getLbUuid() {
|
||||
return lbUuid;
|
||||
}
|
||||
|
||||
public String getSslCertName() {
|
||||
return sslCertName;
|
||||
}
|
||||
|
||||
public String getCertificateKey() {
|
||||
return certificateKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
public String getPrivateIp() {
|
||||
return privateIp;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
UpdateTungstenLoadbalancerSslCommand that = (UpdateTungstenLoadbalancerSslCommand) o;
|
||||
return Objects.equals(lbUuid, that.lbUuid) && Objects.equals(sslCertName, that.sslCertName) && Objects.equals(certificateKey, that.certificateKey) && Objects.equals(privateKey, that.privateKey) && Objects.equals(privateIp, that.privateIp) && Objects.equals(port, that.port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), lbUuid, sslCertName, certificateKey, privateKey, privateIp, port);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
// 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.network.tungsten.agent.api;
|
||||
|
||||
import com.cloud.agent.api.Command;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class UpdateTungstenLoadbalancerStatsCommand extends Command {
|
||||
private final String lbUuid;
|
||||
private final String lbStatsPort;
|
||||
private final String lbStatsUri;
|
||||
private final String lbStatsAuth;
|
||||
|
||||
public UpdateTungstenLoadbalancerStatsCommand(final String lbUuid, final String lbStatsPort,
|
||||
final String lbStatsUri, final String lbStatsAuth) {
|
||||
this.lbUuid = lbUuid;
|
||||
this.lbStatsPort = lbStatsPort;
|
||||
this.lbStatsUri = lbStatsUri;
|
||||
this.lbStatsAuth = lbStatsAuth;
|
||||
}
|
||||
|
||||
public String getLbUuid() {
|
||||
return lbUuid;
|
||||
}
|
||||
|
||||
public String getLbStatsPort() {
|
||||
return lbStatsPort;
|
||||
}
|
||||
|
||||
public String getLbStatsUri() {
|
||||
return lbStatsUri;
|
||||
}
|
||||
|
||||
public String getLbStatsAuth() {
|
||||
return lbStatsAuth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
UpdateTungstenLoadbalancerStatsCommand that = (UpdateTungstenLoadbalancerStatsCommand) o;
|
||||
return Objects.equals(lbUuid, that.lbUuid) && Objects.equals(lbStatsPort, that.lbStatsPort) && Objects.equals(lbStatsUri, that.lbStatsUri) && Objects.equals(lbStatsAuth, that.lbStatsAuth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), lbUuid, lbStatsPort, lbStatsUri, lbStatsAuth);
|
||||
}
|
||||
}
|
||||
@ -406,7 +406,7 @@ public class KubernetesClusterResourceModifierActionWorker extends KubernetesClu
|
||||
if (StringUtils.isNotBlank(kubernetesCluster.getKeyPair())) {
|
||||
keypairs.add(kubernetesCluster.getKeyPair());
|
||||
}
|
||||
if (kubernetesCluster.getSecurityGroupId() != null && networkModel.checkSecurityGroupSupportForNetwork(zone, networkIds, List.of(kubernetesCluster.getSecurityGroupId()))) {
|
||||
if (kubernetesCluster.getSecurityGroupId() != null && networkModel.checkSecurityGroupSupportForNetwork(owner, zone, networkIds, List.of(kubernetesCluster.getSecurityGroupId()))) {
|
||||
List<Long> securityGroupIds = new ArrayList<>();
|
||||
securityGroupIds.add(kubernetesCluster.getSecurityGroupId());
|
||||
nodeVm = userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, clusterTemplate, networkIds, securityGroupIds, owner,
|
||||
|
||||
@ -217,7 +217,7 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif
|
||||
keypairs.add(kubernetesCluster.getKeyPair());
|
||||
}
|
||||
if (kubernetesCluster.getSecurityGroupId() != null &&
|
||||
networkModel.checkSecurityGroupSupportForNetwork(zone, networkIds,
|
||||
networkModel.checkSecurityGroupSupportForNetwork(owner, zone, networkIds,
|
||||
List.of(kubernetesCluster.getSecurityGroupId()))) {
|
||||
List<Long> securityGroupIds = new ArrayList<>();
|
||||
securityGroupIds.add(kubernetesCluster.getSecurityGroupId());
|
||||
@ -294,7 +294,8 @@ public class KubernetesClusterStartWorker extends KubernetesClusterResourceModif
|
||||
keypairs.add(kubernetesCluster.getKeyPair());
|
||||
}
|
||||
if (kubernetesCluster.getSecurityGroupId() != null &&
|
||||
networkModel.checkSecurityGroupSupportForNetwork(zone, networkIds, List.of(kubernetesCluster.getSecurityGroupId()))) {
|
||||
networkModel.checkSecurityGroupSupportForNetwork(owner, zone, networkIds,
|
||||
List.of(kubernetesCluster.getSecurityGroupId()))) {
|
||||
List<Long> securityGroupIds = new ArrayList<>();
|
||||
securityGroupIds.add(kubernetesCluster.getSecurityGroupId());
|
||||
additionalControlVm = userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, clusterTemplate, networkIds, securityGroupIds, owner,
|
||||
|
||||
@ -30,13 +30,6 @@
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>juniper-tungsten-api</id>
|
||||
<url>https://github.com/radu-todirica/tungsten-api/raw/master</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.juniper.tungsten</groupId>
|
||||
|
||||
@ -113,7 +113,6 @@
|
||||
<module>network-elements/stratosphere-ssp</module>
|
||||
<module>network-elements/brocade-vcs</module>
|
||||
<module>network-elements/vxlan</module>
|
||||
<module>network-elements/tungsten</module>
|
||||
|
||||
<module>outofbandmanagement-drivers/ipmitool</module>
|
||||
<module>outofbandmanagement-drivers/nested-cloudstack</module>
|
||||
@ -235,6 +234,7 @@
|
||||
<module>network-elements/cisco-vnmc</module>
|
||||
<module>network-elements/nsx</module>
|
||||
<module>network-elements/juniper-contrail</module>
|
||||
<module>network-elements/tungsten</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
|
||||
@ -26,12 +26,6 @@
|
||||
<artifactId>cloudstack</artifactId>
|
||||
<version>4.20.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>juniper-tungsten-api</id>
|
||||
<url>https://github.com/radu-todirica/tungsten-api/raw/master</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@ -197,11 +191,6 @@
|
||||
<artifactId>metrics-jvm</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.juniper.tungsten</groupId>
|
||||
<artifactId>juniper-tungsten-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@ -788,13 +788,19 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkVO getNetworkWithSGWithFreeIPs(Long zoneId) {
|
||||
public NetworkVO getNetworkWithSGWithFreeIPs(Account account, Long zoneId) {
|
||||
List<NetworkVO> networks = _networksDao.listByZoneSecurityGroup(zoneId);
|
||||
if (networks == null || networks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
NetworkVO ret_network = null;
|
||||
for (NetworkVO nw : networks) {
|
||||
try {
|
||||
checkAccountNetworkPermissions(account, nw);
|
||||
} catch (PermissionDeniedException e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<VlanVO> vlans = _vlanDao.listVlansByNetworkId(nw.getId());
|
||||
for (VlanVO vlan : vlans) {
|
||||
if (_ipAddressDao.countFreeIpsInVlan(vlan.getId()) > 0) {
|
||||
@ -2775,7 +2781,8 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkSecurityGroupSupportForNetwork(DataCenter zone, List<Long> networkIds,
|
||||
public boolean checkSecurityGroupSupportForNetwork(Account account, DataCenter zone,
|
||||
List<Long> networkIds,
|
||||
List<Long> securityGroupsIds) {
|
||||
if (zone.isSecurityGroupEnabled()) {
|
||||
return true;
|
||||
@ -2791,7 +2798,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel, Confi
|
||||
}
|
||||
}
|
||||
} else if (CollectionUtils.isNotEmpty(securityGroupsIds)) {
|
||||
Network networkWithSecurityGroup = getNetworkWithSGWithFreeIPs(zone.getId());
|
||||
Network networkWithSecurityGroup = getNetworkWithSGWithFreeIPs(account, zone.getId());
|
||||
return networkWithSecurityGroup != null;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -4220,7 +4220,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
||||
addDefaultInternalLbProviderToPhysicalNetwork(pNetwork.getId());
|
||||
|
||||
//Add tungsten network service provider
|
||||
addDefaultTungstenProviderToPhysicalNetwork(pNetwork.getId());
|
||||
try {
|
||||
addDefaultTungstenProviderToPhysicalNetwork(pNetwork.getId());
|
||||
} catch (Exception ex) {
|
||||
logger.warn("Failed to add Tungsten provider to physical network due to:" + ex.getMessage());
|
||||
}
|
||||
|
||||
// Add the config drive provider
|
||||
addConfigDriveToPhysicalNetwork(pNetwork.getId());
|
||||
|
||||
@ -1812,7 +1812,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManage
|
||||
null, null, true, null, affinityGroupIdList, customParameters, null, null, null,
|
||||
null, true, overrideDiskOfferingId);
|
||||
} else {
|
||||
if (networkModel.checkSecurityGroupSupportForNetwork(zone, networkIds,
|
||||
if (networkModel.checkSecurityGroupSupportForNetwork(owner, zone, networkIds,
|
||||
Collections.emptyList())) {
|
||||
vm = userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, networkIds, null,
|
||||
owner, vmHostName,vmHostName, diskOfferingId, dataDiskSize, null,
|
||||
|
||||
@ -3126,11 +3126,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
Network defaultNetwork = null;
|
||||
try {
|
||||
DataCenterVO zone = _dcDao.findById(vm.getDataCenterId());
|
||||
|
||||
if (zone.getNetworkType() == NetworkType.Basic) {
|
||||
// Get default guest network in Basic zone
|
||||
defaultNetwork = _networkModel.getExclusiveGuestNetwork(zone.getId());
|
||||
} else if (_networkModel.checkSecurityGroupSupportForNetwork(zone, Collections.emptyList(), securityGroupIdList)) {
|
||||
} else if (_networkModel.checkSecurityGroupSupportForNetwork(_accountMgr.getActiveAccountById(vm.getAccountId()), zone, Collections.emptyList(), securityGroupIdList)) {
|
||||
NicVO defaultNic = _nicDao.findDefaultNicForVM(vm.getId());
|
||||
if (defaultNic != null) {
|
||||
defaultNetwork = _networkDao.findById(defaultNic.getNetworkId());
|
||||
@ -3759,7 +3758,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
|
||||
// If no network is specified, find system security group enabled network
|
||||
if (networkIdList == null || networkIdList.isEmpty()) {
|
||||
Network networkWithSecurityGroup = _networkModel.getNetworkWithSGWithFreeIPs(zone.getId());
|
||||
Network networkWithSecurityGroup = _networkModel.getNetworkWithSGWithFreeIPs(owner, zone.getId());
|
||||
if (networkWithSecurityGroup == null) {
|
||||
throw new InvalidParameterValueException("No network with security enabled is found in zone id=" + zone.getUuid());
|
||||
}
|
||||
@ -6205,7 +6204,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
dataDiskTemplateToDiskOfferingMap, userVmOVFProperties, dynamicScalingEnabled, overrideDiskOfferingId);
|
||||
}
|
||||
} else {
|
||||
if (_networkModel.checkSecurityGroupSupportForNetwork(zone, networkIds,
|
||||
if (_networkModel.checkSecurityGroupSupportForNetwork(owner, zone, networkIds,
|
||||
cmd.getSecurityGroupIdList())) {
|
||||
vm = createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, networkIds, getSecurityGroupIdList(cmd, zone, template, owner), owner, name,
|
||||
displayName, diskOfferingId, size, group, cmd.getHypervisor(), cmd.getHttpMethod(), userData, userDataId, userDataDetails, sshKeyPairNames, cmd.getIpToNetworkMap(), addrs, displayVm, keyboard,
|
||||
@ -7629,7 +7628,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
Set<NetworkVO> applicableNetworks = new LinkedHashSet<>();
|
||||
Map<Long, String> requestedIPv4ForNics = new HashMap<>();
|
||||
Map<Long, String> requestedIPv6ForNics = new HashMap<>();
|
||||
if (_networkModel.checkSecurityGroupSupportForNetwork(zone, networkIdList, securityGroupIdList)) { // advanced zone with security groups
|
||||
if (_networkModel.checkSecurityGroupSupportForNetwork(newAccount, zone, networkIdList, securityGroupIdList)) { // advanced zone with security groups
|
||||
// cleanup the old security groups
|
||||
_securityGroupMgr.removeInstanceFromGroups(cmd.getVmId());
|
||||
// if networkIdList is null and the first network of vm is shared network, then keep it if possible
|
||||
@ -8859,7 +8858,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
private Network getNetworkForOvfNetworkMapping(DataCenter zone, Account owner) throws InsufficientCapacityException, ResourceAllocationException {
|
||||
Network network = null;
|
||||
if (zone.isSecurityGroupEnabled() || _networkModel.isSecurityGroupSupportedForZone(zone.getId())) {
|
||||
network = _networkModel.getNetworkWithSGWithFreeIPs(zone.getId());
|
||||
network = _networkModel.getNetworkWithSGWithFreeIPs(owner, zone.getId());
|
||||
if (network == null) {
|
||||
throw new InvalidParameterValueException("No network with security enabled is found in zone ID: " + zone.getUuid());
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
||||
* @see com.cloud.network.NetworkModel#getNetworkWithSGWithFreeIPs(java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public NetworkVO getNetworkWithSGWithFreeIPs(Long zoneId) {
|
||||
public NetworkVO getNetworkWithSGWithFreeIPs(Account account, Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@ -950,7 +950,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkSecurityGroupSupportForNetwork(DataCenter zone, List<Long> networkIds, List<Long> securityGroupsIds) {
|
||||
public boolean checkSecurityGroupSupportForNetwork(Account account, DataCenter zone, List<Long> networkIds, List<Long> securityGroupsIds) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1318,7 +1318,8 @@ public class AutoScaleManagerImplTest {
|
||||
when(userVmService.createAdvancedSecurityGroupVirtualMachine(any(), any(), any(), any(), any(), any(), any(),
|
||||
any(), any(), any(), any(), any(), any(), eq(userData), eq(userDataId), eq(userDataDetails.toString()), any(), any(), any(), any(), any(), any(),
|
||||
any(), any(), any(), any(), any(), eq(true), any(), any())).thenReturn(userVmMock);
|
||||
when(networkModel.checkSecurityGroupSupportForNetwork(zoneMock, List.of(networkId), Collections.emptyList())).thenReturn(true);
|
||||
when(networkModel.checkSecurityGroupSupportForNetwork(account, zoneMock,
|
||||
List.of(networkId), Collections.emptyList())).thenReturn(true);
|
||||
|
||||
long result = autoScaleManagerImplSpy.createNewVM(asVmGroupMock);
|
||||
|
||||
@ -1367,7 +1368,8 @@ public class AutoScaleManagerImplTest {
|
||||
when(userVmService.createAdvancedVirtualMachine(any(), any(), any(), any(), any(), any(), any(),
|
||||
any(), any(), any(), any(), any(), eq(userData), eq(userDataId), eq(userDataDetails.toString()), any(), any(), any(), eq(true), any(), any(), any(),
|
||||
any(), any(), any(), any(), eq(true), any(), any())).thenReturn(userVmMock);
|
||||
when(networkModel.checkSecurityGroupSupportForNetwork(zoneMock, List.of(networkId), Collections.emptyList())).thenReturn(false);
|
||||
when(networkModel.checkSecurityGroupSupportForNetwork(account, zoneMock,
|
||||
List.of(networkId), Collections.emptyList())).thenReturn(false);
|
||||
|
||||
long result = autoScaleManagerImplSpy.createNewVM(asVmGroupMock);
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
||||
* @see com.cloud.network.NetworkModel#getNetworkWithSGWithFreeIPs(java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public NetworkVO getNetworkWithSGWithFreeIPs(Long zoneId) {
|
||||
public NetworkVO getNetworkWithSGWithFreeIPs(Account account, Long zoneId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@ -966,7 +966,8 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkSecurityGroupSupportForNetwork(DataCenter zone, List<Long> networkIds, List<Long> securityGroupsIds) {
|
||||
public boolean checkSecurityGroupSupportForNetwork(Account account, DataCenter zone,
|
||||
List<Long> networkIds, List<Long> securityGroupsIds) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,7 @@
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
|
||||
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.20.0.0-SNAPSHOT"
|
||||
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.20.0.0-SNAPSHOT" Author="Apache CloudStack <dev@cloudstack.apache.org>"
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
|
||||
@ -19,8 +19,7 @@
|
||||
# build for cloudstack_home_dir not this folder
|
||||
FROM python:2
|
||||
|
||||
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
|
||||
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.20.0.0-SNAPSHOT"
|
||||
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.20.0.0-SNAPSHOT" Author="Apache CloudStack <dev@cloudstack.apache.org>"
|
||||
|
||||
ENV WORK_DIR=/marvin
|
||||
|
||||
|
||||
@ -19,8 +19,7 @@
|
||||
|
||||
FROM ubuntu:16.04
|
||||
|
||||
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
|
||||
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.12.0-SNAPSHOT"
|
||||
LABEL Vendor="Apache.org" License="ApacheV2" Version="4.20.0-SNAPSHOT" Author="Apache CloudStack <dev@cloudstack.apache.org>"
|
||||
|
||||
RUN apt-get -y update && apt-get install -y \
|
||||
genisoimage \
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
|
||||
FROM node:14-bullseye AS build
|
||||
|
||||
MAINTAINER "Apache CloudStack" <dev@cloudstack.apache.org>
|
||||
LABEL Description="Apache CloudStack UI; Modern role-base progressive UI for Apache CloudStack"
|
||||
LABEL Vendor="Apache.org"
|
||||
LABEL License=ApacheV2
|
||||
LABEL Version=0.5.0
|
||||
LABEL Author="Apache CloudStack <dev@cloudstack.apache.org>"
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ export default {
|
||||
const projects = []
|
||||
const getNextPage = () => {
|
||||
this.loading = true
|
||||
api('listProjects', { listAll: true, page: page, pageSize: 500, showIcon: true }).then(json => {
|
||||
api('listProjects', { listAll: true, page: page, pageSize: 500, details: 'min', showIcon: true }).then(json => {
|
||||
if (json?.listprojectsresponse?.project) {
|
||||
projects.push(...json.listprojectsresponse.project)
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ export default {
|
||||
return filters
|
||||
},
|
||||
columns: () => {
|
||||
const fields = ['displayname', 'state', 'ipaddress']
|
||||
const fields = ['name', 'state', 'ipaddress']
|
||||
const metricsFields = ['cpunumber', 'cputotal', 'cpuused', 'memorytotal',
|
||||
{
|
||||
memoryused: (record) => {
|
||||
@ -77,7 +77,7 @@ export default {
|
||||
fields.push('zonename')
|
||||
return fields
|
||||
},
|
||||
searchFilters: ['displayname', 'zoneid', 'domainid', 'account', 'groupid', 'tags'],
|
||||
searchFilters: ['name', 'zoneid', 'domainid', 'account', 'groupid', 'tags'],
|
||||
details: () => {
|
||||
var fields = ['name', 'displayname', 'id', 'state', 'ipaddress', 'ip6address', 'templatename', 'ostypename',
|
||||
'serviceofferingname', 'isdynamicallyscalable', 'haenable', 'hypervisor', 'boottype', 'bootmode', 'account',
|
||||
|
||||
@ -237,6 +237,11 @@ export default {
|
||||
|
||||
const resourceName = params.displayname || params.displaytext || params.name || this.resource.name
|
||||
let hasJobId = false
|
||||
Object.keys(params).forEach(key => {
|
||||
if (params[key] === '') {
|
||||
delete params[key]
|
||||
}
|
||||
})
|
||||
api(this.action.api, params).then(json => {
|
||||
for (const obj in json) {
|
||||
if (obj.includes('response')) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user