Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
import javax.naming.ConfigurationException;
import javax.persistence.EntityExistsException;

import com.cloud.domain.Domain;
import com.cloud.domain.dao.DomainDao;
import com.cloud.network.vpc.VpcVO;
import com.cloud.network.vpc.dao.VpcDao;
import com.cloud.user.dao.AccountDao;
Expand Down Expand Up @@ -392,6 +394,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
private AccountDao accountDao;
@Inject
private VpcDao vpcDao;
@Inject
private DomainDao domainDao;

VmWorkJobHandlerProxy _jobHandlerProxy = new VmWorkJobHandlerProxy(this);

Expand Down Expand Up @@ -1478,7 +1482,9 @@ private void setVmNetworkDetails(VMInstanceVO vm, VirtualMachineTO vmTO) {
for (UserVmJoinVO userVmJoinVO : userVmJoinVOs) {
NetworkVO networkVO = _networkDao.findById(userVmJoinVO.getNetworkId());
Account acc = accountDao.findById(networkVO.getAccountId());
String networkName = acc.getAccountName() + "-" ;
Domain domain = domainDao.findById(networkVO.getDomainId());
DataCenter zone = _dcDao.findById(vm.getDataCenterId());
String networkName = domain.getName() + "-" + acc.getAccountName() + "-" + zone.getName() + "-";
if (Objects.isNull(networkVO.getVpcId())) {
networkName += networkVO.getName();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public class CreateNsxDhcpRelayConfigCommand extends NsxCommand {
private String networkName;
private List<String> addresses;

public CreateNsxDhcpRelayConfigCommand(String zoneName, Long zoneId, String accountName, Long accountId,
public CreateNsxDhcpRelayConfigCommand(String domainName, String accountName, String zoneName,
String vpcName, String networkName, List<String> addresses) {
super(zoneName, zoneId, accountName, accountId);
super(domainName, accountName, zoneName);
this.vpcName = vpcName;
this.networkName = networkName;
this.addresses = addresses;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,38 @@
// under the License.
package org.apache.cloudstack.agent.api;

import com.cloud.network.dao.NetworkVO;

import java.util.Objects;

public class CreateNsxSegmentCommand extends CreateNsxTier1GatewayCommand {
private NetworkVO tierNetwork;
public CreateNsxSegmentCommand(String zoneName, Long zoneId, String accountName, Long accountId, String vpcName, NetworkVO tierNetwork) {
super(zoneName, zoneId, accountName, accountId, vpcName);
this.tierNetwork = tierNetwork;
public class CreateNsxSegmentCommand extends NsxCommand {

private String vpcName;
private String networkName;
private String networkGateway;
private String networkCidr;

public CreateNsxSegmentCommand(String domainName, String accountName, String zoneName,
String vpcName, String networkName, String networkGateway, String networkCidr) {
super(domainName, accountName, zoneName);
this.vpcName = vpcName;
this.networkName = networkName;
this.networkGateway = networkGateway;
this.networkCidr = networkCidr;
}

public String getVpcName() {
return vpcName;
}

public String getNetworkName() {
return networkName;
}

public NetworkVO getTierNetwork() {
return tierNetwork;
public String getNetworkGateway() {
return networkGateway;
}

public void setTierNetwork(NetworkVO tierNetwork) {
this.tierNetwork = tierNetwork;
public String getNetworkCidr() {
return networkCidr;
}

@Override
Expand All @@ -41,11 +56,11 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CreateNsxSegmentCommand command = (CreateNsxSegmentCommand) o;
return Objects.equals(tierNetwork, command.tierNetwork);
return Objects.equals(networkName, command.networkName);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), tierNetwork);
return Objects.hash(super.hashCode(), networkName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@
public class CreateNsxTier1GatewayCommand extends NsxCommand {
private String vpcName;

public CreateNsxTier1GatewayCommand(String zoneName, Long zoneId, String accountName, Long accountId, String vpcName) {
super(zoneName, zoneId, accountName, accountId);
public CreateNsxTier1GatewayCommand(String domainName, String accountName, String zoneName, String vpcName) {
super(domainName, accountName, zoneName);
this.vpcName = vpcName;
}

public String getVpcName() {
return vpcName;
}

public void setVpcName(String vpcName) {
this.vpcName = vpcName;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@
// under the License.
package org.apache.cloudstack.agent.api;

import com.cloud.network.dao.NetworkVO;
public class DeleteNsxSegmentCommand extends NsxCommand {

public class DeleteNsxSegmentCommand extends CreateNsxSegmentCommand {
public DeleteNsxSegmentCommand(String zoneName, String accountName, String vpcName, NetworkVO network) {
super(zoneName, network.getDataCenterId(), accountName, network.getAccountId(), vpcName, network);
private String vpcName;
private String networkName;

public DeleteNsxSegmentCommand(String domainName, String accountName, String zoneName, String vpcName, String networkName) {
super(domainName, accountName, zoneName);
this.vpcName = vpcName;
this.networkName = networkName;
}

public String getVpcName() {
return vpcName;
}

public String getNetworkName() {
return networkName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@
// under the License.
package org.apache.cloudstack.agent.api;

public class DeleteNsxTier1GatewayCommand extends CreateNsxTier1GatewayCommand {
public class DeleteNsxTier1GatewayCommand extends NsxCommand {

public DeleteNsxTier1GatewayCommand(String zoneName, Long zoneId, String accountName, Long accountId, String vpcName) {
super(zoneName, zoneId, accountName, accountId, vpcName);
private String vpcName;

public DeleteNsxTier1GatewayCommand(String domainName, String accountName, String zoneName, String vpcName) {
super(domainName, accountName, zoneName);
this.vpcName = vpcName;
}

public String getVpcName() {
return vpcName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,27 @@

public class NsxCommand extends Command {
private String zoneName;
private Long zoneId;
private String accountName;
private Long accountId;
private String domainName;

public NsxCommand(String zoneName, Long zoneId, String accountName, Long accountId) {
public NsxCommand(String domainName, String accountName, String zoneName) {
this.zoneName = zoneName;
this.zoneId = zoneId;
this.accountName = accountName;
this.accountId = accountId;
this.domainName = domainName;
}

public String getZoneName() {
return zoneName;
}

public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}

public Long getZoneId() {
return zoneId;
}

public void setZoneId(Long zoneId) {
this.zoneId = zoneId;
}

public String getAccountName() {
return accountName;
}

public void setAccountName(String accountName) {
this.accountName = accountName;
public String getDomainName() {
return domainName;
}

public Long getAccountId() {
return accountId;
}

public void setAccountId(Long accountId) {
this.accountId = accountId;
}
@Override
public boolean executeInSequence() {
return false;
Expand All @@ -75,11 +54,11 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
NsxCommand that = (NsxCommand) o;
return Objects.equals(zoneName, that.zoneName) && Objects.equals(zoneId, that.zoneId) && Objects.equals(accountName, that.accountName) && Objects.equals(accountId, that.accountId);
return Objects.equals(zoneName, that.zoneName) && Objects.equals(accountName, that.accountName) && Objects.equals(domainName, that.domainName);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), zoneName, zoneId, accountName, accountId);
return Objects.hash(super.hashCode(), zoneName, accountName, domainName);
}
}
Loading