Skip to content
Open
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
9 changes: 9 additions & 0 deletions api/src/main/java/com/cloud/agent/api/to/NicTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class NicTO extends NetworkTO {
boolean enabled;

String networkSegmentName;
private Integer multiqueueNumber;

public NicTO() {
super();
Expand Down Expand Up @@ -163,4 +164,12 @@ public boolean isEnabled() {
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public Integer getMultiqueueNumber() {
return multiqueueNumber;
}

public void setMultiqueueNumber(Integer multiqueueNumber) {
this.multiqueueNumber = multiqueueNumber;
}
}
4 changes: 2 additions & 2 deletions api/src/main/java/com/cloud/network/NetworkModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ public interface NetworkModel {

boolean isNetworkAvailableInDomain(long networkId, long domainId);

NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri);
NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri, Integer multiqueueNumber);

NicProfile getNicProfile(VirtualMachine vm, Nic nic, DataCenter dataCenter);
NicProfile getNicProfile(VirtualMachine vm, Nic nic, DataCenter dataCenter, Integer multiqueueNumber);

Set<Long> getAvailableIps(Network network, String requestedIp);

Expand Down
4 changes: 4 additions & 0 deletions api/src/main/java/com/cloud/network/vpc/VpcOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ public enum State {
Boolean isSpecifyAsNumber();

boolean isConserveMode();

Integer getPublicMultiqueueNumber();

Integer getPrivateGatewayMultiqueueNumber();
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ VpcOffering createVpcOffering(String name, String displayText, List<String> supp
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
Long serviceOfferingId, String externalProvider, NetworkOffering.NetworkMode networkMode,
List<Long> domainIds, List<Long> zoneIds, VpcOffering.State state,
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber, boolean conserveMode);
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber, boolean conserveMode,
Integer publicMultiqueueNumber, Integer privateGatewayMultiqueueNumber);


Pair<List<? extends VpcOffering>,Integer> listVpcOfferings(ListVPCOfferingsCmd cmd);
Expand Down
4 changes: 4 additions & 0 deletions api/src/main/java/com/cloud/offering/NetworkOffering.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,8 @@ enum RoutingMode {
RoutingMode getRoutingMode();

Boolean isSpecifyAsNumber();

Integer getPublicMultiqueueNumber();

Integer getPrivateMultiqueueNumber();
}
9 changes: 9 additions & 0 deletions api/src/main/java/com/cloud/vm/NicProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class NicProfile implements InternalIdentity, Serializable {
boolean enabled;

Integer orderIndex;
private Integer multiqueueNumber;

// IPv4
String iPv4Address;
Expand Down Expand Up @@ -424,6 +425,14 @@ public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

public Integer getMultiqueueNumber() {
return multiqueueNumber;
}

public void setMultiqueueNumber(Integer multiqueueNumber) {
this.multiqueueNumber = multiqueueNumber;
}

//
// OTHER METHODS
//
Expand Down
4 changes: 4 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,10 @@ public class ApiConstants {
public static final String SCHEDULED_DATE = "scheduleddate";
public static final String BACKUP_PROVIDER = "backupprovider";

public static final String PRIVATE_MULTIQUEUE_NUMBER = "privatemultiqueuenumber";
public static final String PUBLIC_MULTIQUEUE_NUMBER = "publicmultiqueuenumber";
public static final String PRIVATE_GATEWAY_MULTIQUEUE_NUMBER = "privategatewaymultiqueuenumber";

/**
* This enum specifies IO Drivers, each option controls specific policies on I/O.
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ public abstract class NetworkOfferingBaseCmd extends BaseCmd {
description = "the routing mode for the network offering. Supported types are: Static or Dynamic.")
private String routingMode;

@Parameter(name = ApiConstants.PUBLIC_MULTIQUEUE_NUMBER, type = CommandType.INTEGER, since = "24.0",
description = "Multiqueue number for the public NIC of VRs belonging to guest networks. This parameter " +
"is not allowed for L2 network and isolated network for VPC (tier) offerings.")
private Integer publicMultiqueueNumber;

@Parameter(name = ApiConstants.PRIVATE_MULTIQUEUE_NUMBER, type = CommandType.INTEGER, since = "24.0",
description = "Multiqueue number for the private NICs of VRs belonging to guest networks and VPC tiers. " +
"This parameter is not allowed for L2 network offerings")
private Integer privateMultiqueueNumber;

private Map<String, String> sourceDetailsMap;

/////////////////////////////////////////////////////
Expand Down Expand Up @@ -484,6 +494,14 @@ public String getRoutingMode() {
return routingMode;
}

public Integer getPublicMultiqueueNumber() {
return publicMultiqueueNumber;
}

public Integer getPrivateMultiqueueNumber() {
return privateMultiqueueNumber;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
description = "True if the VPC offering is IP conserve mode enabled, allowing public IPs to be used across multiple VPC tiers. Default value is false")
private Boolean conserveMode;

@Parameter(name = ApiConstants.PUBLIC_MULTIQUEUE_NUMBER, type = CommandType.INTEGER, since = "24.0",
description = "Multiqueue number for the public NIC of VRs belonging to VPCs.")
private Integer publicMultiqueueNumber;

@Parameter(name = ApiConstants.PRIVATE_GATEWAY_MULTIQUEUE_NUMBER, type = CommandType.INTEGER, since = "24.0",
description = "Multiqueue number for the private gateway NIC of VRs belonging to VPCs.")
private Integer privateGatewayMultiqueueNumber;


/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand Down Expand Up @@ -318,6 +326,14 @@ public boolean isConserveMode() {
return BooleanUtils.toBoolean(conserveMode);
}

public Integer getPublicMultiqueueNumber() {
return publicMultiqueueNumber;
}

public Integer getPrivateGatewayMultiqueueNumber() {
return privateGatewayMultiqueueNumber;
}

@Override
public void create() throws ResourceAllocationException {
VpcOffering vpcOff = _vpcProvSvc.createVpcOffering(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations {
@Param(description = "the routing mode for the network offering, supported types are Static or Dynamic.")
private String routingMode;

@SerializedName(ApiConstants.PUBLIC_MULTIQUEUE_NUMBER)
@Param(description = "Multiqueue number for the public NIC of VRs belonging to isolated networks.", since = "24.0")
private Integer publicMultiqueueNumber;

@SerializedName(ApiConstants.PRIVATE_MULTIQUEUE_NUMBER)
@Param(description = "Multiqueue number for the private NICs of VRs belonging to isolated networks and VPC tiers.", since = "24.0")
private Integer privateMultiqueueNumber;

public void setId(String id) {
this.id = id;
}
Expand Down Expand Up @@ -342,4 +350,12 @@ public String getServiceOfferingName() {
public void setServiceOfferingName(String serviceOfferingName) {
this.serviceOfferingName = serviceOfferingName;
}

public void setPublicMultiqueueNumber(Integer publicMultiqueueNumber) {
this.publicMultiqueueNumber = publicMultiqueueNumber;
}

public void setPrivateMultiqueueNumber(Integer privateMultiqueueNumber) {
this.privateMultiqueueNumber = privateMultiqueueNumber;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public class VpcOfferingResponse extends BaseResponse {
@Param(description = "True if the VPC offering is IP conserve mode enabled, allowing public IP services to be used across multiple VPC tiers.", since = "4.23.0")
private Boolean conserveMode;

@SerializedName(ApiConstants.PUBLIC_MULTIQUEUE_NUMBER)
@Param(description = "Multiqueue number for the public NIC of VRs belonging to VPCs.", since = "24.0")
private Integer publicMultiqueueNumber;

@SerializedName(ApiConstants.PRIVATE_GATEWAY_MULTIQUEUE_NUMBER)
@Param(description = "Multiqueue number for the private gateway NIC of VRs belonging to VPCs.", since = "24.0")
private Integer privateGatewayMultiqueueNumber;

public void setId(String id) {
this.id = id;
}
Expand Down Expand Up @@ -213,4 +221,12 @@ public Boolean getConserveMode() {
public void setConserveMode(Boolean conserveMode) {
this.conserveMode = conserveMode;
}

public void setPublicMultiqueueNumber(Integer publicMultiqueueNumber) {
this.publicMultiqueueNumber = publicMultiqueueNumber;
}

public void setPrivateGatewayMultiqueueNumber(Integer privateGatewayMultiqueueNumber) {
this.privateGatewayMultiqueueNumber = privateGatewayMultiqueueNumber;
}
}
32 changes: 22 additions & 10 deletions core/src/main/java/com/cloud/agent/api/PlugNicCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,12 @@
import java.util.Map;

public class PlugNicCommand extends Command {

NicTO nic;
String instanceName;
VirtualMachine.Type vmType;
private Integer targetVmCpus;
Map<String, String> details;

public NicTO getNic() {
return nic;
}

@Override
public boolean executeInSequence() {
return true;
}

protected PlugNicCommand() {
}

Expand All @@ -56,6 +47,18 @@ public PlugNicCommand(NicTO nic, String instanceName, VirtualMachine.Type vmtype
this.details = details;
}

public PlugNicCommand(NicTO nic, String instanceName, VirtualMachine.Type vmtype, Integer targetVmCpus, Map<String, String> details) {
this.nic = nic;
this.instanceName = instanceName;
this.vmType = vmtype;
this.targetVmCpus = targetVmCpus;
this.details = details;
}

public NicTO getNic() {
return nic;
}

public String getVmName() {
return instanceName;
}
Expand All @@ -67,4 +70,13 @@ public VirtualMachine.Type getVMType() {
public Map<String, String> getDetails() {
return this.details;
}

public Integer getTargetVmCpus() {
return targetVmCpus;
}

@Override
public boolean executeInSequence() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ NetworkOfferingVO createNetworkOffering(String name, String displayText, Traffic
boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap, boolean specifyIpRanges, boolean isPersistent,
Map<NetworkOffering.Detail, String> details, boolean egressDefaultPolicy, Integer maxconn, boolean enableKeepAlive, Boolean forVpc,
Boolean forTungsten, boolean forNsx, boolean forNetris, NetworkOffering.NetworkMode networkMode, List<Long> domainIds, List<Long> zoneIds, boolean enableOffering, final NetUtils.InternetProtocol internetProtocol,
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);
NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber, Integer publicMultiqueueNumber, Integer privateMultiqueueNumber);

Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, boolean forSystemVms, Long podId, String startIP, String endIP,
String vlanGateway, String vlanNetmask, String vlanId, boolean bypassVlanOverlapCheck, Domain domain, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr, Provider provider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ protected void processPrepareExternalProvisioning(boolean firstStart, Host host,
List<NicVO> nics = _nicsDao.listByVmId(vmProfile.getId());
NicTO[] nicTOs = new NicTO[nics.size()];
nics.forEach(nicVO -> {
NicTO nicTO = toNicTO(_networkModel.getNicProfile(vmProfile.getVirtualMachine(), nicVO, dataCenter),
NicTO nicTO = toNicTO(_networkModel.getNicProfile(vmProfile.getVirtualMachine(), nicVO, dataCenter, null),
HypervisorType.External);
nicTOs[nicTO.getDeviceId()] = nicTO;
});
Expand Down Expand Up @@ -5161,8 +5161,8 @@ public boolean plugNic(final Network network, final NicTO nic, final VirtualMach
ResourceUnavailableException, InsufficientCapacityException {
boolean result = true;

final VMInstanceVO router = _vmDao.findById(vm.getId());
if (router.getState() == State.Running) {
final VMInstanceVO targetVm = _vmDao.findById(vm.getId());
if (targetVm.getState() == State.Running) {
try {
NetworkDetailVO pvlanTypeDetail = networkDetailsDao.findDetail(network.getId(), ApiConstants.ISOLATED_PVLAN_TYPE);
if (pvlanTypeDetail != null) {
Expand All @@ -5171,7 +5171,7 @@ public boolean plugNic(final Network network, final NicTO nic, final VirtualMach
nicDetails.putIfAbsent(NetworkOffering.Detail.pvlanType, pvlanTypeDetail.getValue());
nic.setDetails(nicDetails);
}
final PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName(), vm.getType(), vm.getDetails());
final PlugNicCommand plugNicCmd = new PlugNicCommand(nic, vm.getName(), vm.getType(), vm.getCpus(), vm.getDetails());
final Commands cmds = new Commands(Command.OnError.Stop);
cmds.addCommand("plugnic", plugNicCmd);
_agentMgr.send(dest.getHost().getId(), cmds);
Expand All @@ -5184,11 +5184,11 @@ public boolean plugNic(final Network network, final NicTO nic, final VirtualMach
throw new AgentUnavailableException("Unable to plug nic for router " + vm.getName() + " in network " + network, dest.getHost().getId(), e);
}
} else {
String message = String.format("Unable to apply PlugNic, VM [%s] is not in the right state (\"Running\"). VM state [%s].", router.toString(), router.getState());
String message = String.format("Unable to plug NIC to VM [%s], as it is not in the right state (\"Running\"). VM state [%s].", targetVm, targetVm.getState());
logger.warn(message);

throw new ResourceUnavailableException(message, DataCenter.class,
router.getDataCenterId());
targetVm.getDataCenterId());
}

return result;
Expand Down
Loading
Loading