Skip to content

Commit e61ca8e

Browse files
committed
Merge branch 'main' of https://github.com/apache/cloudstack into netris-integration-upstream
2 parents 8ad95c4 + 5b7c3b4 commit e61ca8e

File tree

183 files changed

+7648
-4571
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+7648
-4571
lines changed

INSTALL.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ Install tools and dependencies used for development:
1818
# yum -y install git java-17-openjdk java-17-openjdk-devel \
1919
mysql mysql-server mkisofs git gcc python MySQL-python openssh-clients wget
2020

21-
Set up Maven (3.6.0):
21+
Set up Maven (3.9.10):
2222

23-
# wget https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
24-
# tar -zxvf apache-maven-3.9.9-bin.tar.gz -C /usr/local
23+
# wget https://dlcdn.apache.org/maven/maven-3/3.9.10/binaries/apache-maven-3.9.10-bin.tar.gz
24+
# sudo tar -zxvf apache-maven-3.9.10-bin.tar.gz -C /usr/local
2525
# cd /usr/local
26-
# ln -s apache-maven-3.9.9 maven
26+
# sudo ln -s apache-maven-3.9.10 maven
2727
# echo export M2_HOME=/usr/local/maven >> ~/.bashrc # or .zshrc or .profile
2828
# echo export PATH=/usr/local/maven/bin:${PATH} >> ~/.bashrc # or .zshrc or .profile
2929
# source ~/.bashrc
3030

31-
Setup up NodeJS (LTS):
31+
Setup up Node.js 16:
3232

33-
# curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
33+
# curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
3434
# sudo yum install nodejs
3535
# sudo npm install -g @vue/cli npm-check-updates
3636

@@ -104,13 +104,13 @@ To install dependencies.
104104

105105
To build the project.
106106

107-
$ npm build
107+
$ npm run build
108108

109109
For Development Mode.
110110

111111
$ npm start
112112

113-
Make sure to set CS_URL=http://localhost:8080/client on .env.local file on ui.
113+
Make sure to set `CS_URL=http://localhost:8080` on the `.env.local` file on UI.
114114

115115
You should be able to run the management server on http://localhost:5050
116116

api/src/main/java/com/cloud/agent/api/to/VirtualMachineTO.java

Lines changed: 85 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public class VirtualMachineTO {
3131
private String name;
3232
private BootloaderType bootloader;
3333
private VirtualMachine.State state;
34-
Type type;
35-
int cpus;
34+
private Type type;
35+
private int cpus;
3636

3737
/**
3838
'speed' is still here since 4.0.X/4.1.X management servers do not support
@@ -43,49 +43,50 @@ public class VirtualMachineTO {
4343
So this is here for backwards compatibility with 4.0.X/4.1.X management servers
4444
and newer agents.
4545
*/
46-
Integer speed;
47-
Integer minSpeed;
48-
Integer maxSpeed;
49-
50-
long minRam;
51-
long maxRam;
52-
String hostName;
53-
String arch;
54-
String os;
55-
String platformEmulator;
56-
String bootArgs;
57-
String[] bootupScripts;
58-
boolean enableHA;
59-
boolean limitCpuUse;
60-
boolean enableDynamicallyScaleVm;
46+
private Integer speed;
47+
private Integer minSpeed;
48+
private Integer maxSpeed;
49+
50+
private long minRam;
51+
private long maxRam;
52+
private String hostName;
53+
private String arch;
54+
private String os;
55+
private String platformEmulator;
56+
private String bootArgs;
57+
private String[] bootupScripts;
58+
private boolean enableHA;
59+
private boolean limitCpuUse;
60+
private boolean enableDynamicallyScaleVm;
6161
@LogLevel(LogLevel.Log4jLevel.Off)
62-
String vncPassword;
63-
String vncAddr;
64-
Map<String, String> details;
65-
String uuid;
66-
String bootType;
67-
String bootMode;
68-
boolean enterHardwareSetup;
69-
70-
DiskTO[] disks;
71-
NicTO[] nics;
72-
GPUDeviceTO gpuDevice;
73-
Integer vcpuMaxLimit;
74-
List<String[]> vmData = null;
75-
76-
String configDriveLabel = null;
77-
String configDriveIsoRootFolder = null;
78-
String configDriveIsoFile = null;
79-
NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY;
80-
81-
Double cpuQuotaPercentage = null;
82-
83-
Map<String, String> guestOsDetails = new HashMap<String, String>();
84-
Map<String, String> extraConfig = new HashMap<>();
85-
Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
86-
DeployAsIsInfoTO deployAsIsInfo;
87-
String metadataManufacturer;
88-
String metadataProductName;
62+
private String vncPassword;
63+
private String vncAddr;
64+
private Map<String, String> details;
65+
private Map<String, String> params;
66+
private String uuid;
67+
private String bootType;
68+
private String bootMode;
69+
private boolean enterHardwareSetup;
70+
71+
private DiskTO[] disks;
72+
private NicTO[] nics;
73+
private GPUDeviceTO gpuDevice;
74+
private Integer vcpuMaxLimit;
75+
private List<String[]> vmData = null;
76+
77+
private String configDriveLabel = null;
78+
private String configDriveIsoRootFolder = null;
79+
private String configDriveIsoFile = null;
80+
private NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY;
81+
82+
private Double cpuQuotaPercentage = null;
83+
84+
private Map<String, String> guestOsDetails = new HashMap<String, String>();
85+
private Map<String, String> extraConfig = new HashMap<>();
86+
private Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
87+
private DeployAsIsInfoTO deployAsIsInfo;
88+
private String metadataManufacturer;
89+
private String metadataProductName;
8990

9091
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
9192
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
@@ -260,6 +261,10 @@ public void setBootupScripts(String[] bootupScripts) {
260261
this.bootupScripts = bootupScripts;
261262
}
262263

264+
public void setEnableHA(boolean enableHA) {
265+
this.enableHA = enableHA;
266+
}
267+
263268
public DiskTO[] getDisks() {
264269
return disks;
265270
}
@@ -435,6 +440,42 @@ public void setDeployAsIsInfo(DeployAsIsInfoTO deployAsIsInfo) {
435440
this.deployAsIsInfo = deployAsIsInfo;
436441
}
437442

443+
public void setSpeed(Integer speed) {
444+
this.speed = speed;
445+
}
446+
447+
public void setMinSpeed(Integer minSpeed) {
448+
this.minSpeed = minSpeed;
449+
}
450+
451+
public void setMaxSpeed(Integer maxSpeed) {
452+
this.maxSpeed = maxSpeed;
453+
}
454+
455+
public void setMinRam(long minRam) {
456+
this.minRam = minRam;
457+
}
458+
459+
public void setMaxRam(long maxRam) {
460+
this.maxRam = maxRam;
461+
}
462+
463+
public void setLimitCpuUse(boolean limitCpuUse) {
464+
this.limitCpuUse = limitCpuUse;
465+
}
466+
467+
public Map<String, String> getParams() {
468+
return params;
469+
}
470+
471+
public void setParams(Map<String, String> params) {
472+
this.params = params;
473+
}
474+
475+
public void setExtraConfig(Map<String, String> extraConfig) {
476+
this.extraConfig = extraConfig;
477+
}
478+
438479
public String getMetadataManufacturer() {
439480
return metadataManufacturer;
440481
}

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public class EventTypes {
289289

290290
//registering userdata events
291291
public static final String EVENT_REGISTER_USER_DATA = "REGISTER.USER.DATA";
292+
public static final String EVENT_REGISTER_CNI_CONFIG = "REGISTER.CNI.CONFIG";
293+
public static final String EVENT_DELETE_CNI_CONFIG = "DELETE.CNI.CONFIG";
292294

293295
//register for user API and secret keys
294296
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ enum Event {
4444
AutoscaleRequested,
4545
ScaleUpRequested,
4646
ScaleDownRequested,
47+
AddNodeRequested,
48+
RemoveNodeRequested,
4749
UpgradeRequested,
4850
OperationSucceeded,
4951
OperationFailed,
@@ -59,6 +61,8 @@ enum State {
5961
Stopped("All resources for the Kubernetes cluster are destroyed, Kubernetes cluster may still have ephemeral resource like persistent volumes provisioned"),
6062
Scaling("Transient state in which resources are either getting scaled up/down"),
6163
Upgrading("Transient state in which cluster is getting upgraded"),
64+
Importing("Transient state in which additional nodes are added as worker nodes to a cluster"),
65+
RemovingNodes("Transient state in which additional nodes are removed from a cluster"),
6266
Alert("State to represent Kubernetes clusters which are not in expected desired state (operationally in active control place, stopped cluster VM's etc)."),
6367
Recovering("State in which Kubernetes cluster is recovering from alert state"),
6468
Destroyed("End state of Kubernetes cluster in which all resources are destroyed, cluster will not be usable further"),
@@ -96,6 +100,17 @@ enum State {
96100
s_fsm.addTransition(State.Upgrading, Event.OperationSucceeded, State.Running);
97101
s_fsm.addTransition(State.Upgrading, Event.OperationFailed, State.Alert);
98102

103+
s_fsm.addTransition(State.Running, Event.AddNodeRequested, State.Importing);
104+
s_fsm.addTransition(State.Alert, Event.AddNodeRequested, State.Importing);
105+
s_fsm.addTransition(State.Importing, Event.OperationSucceeded, State.Running);
106+
s_fsm.addTransition(State.Importing, Event.OperationFailed, State.Running);
107+
s_fsm.addTransition(State.Alert, Event.OperationSucceeded, State.Running);
108+
109+
s_fsm.addTransition(State.Running, Event.RemoveNodeRequested, State.RemovingNodes);
110+
s_fsm.addTransition(State.Alert, Event.RemoveNodeRequested, State.RemovingNodes);
111+
s_fsm.addTransition(State.RemovingNodes, Event.OperationSucceeded, State.Running);
112+
s_fsm.addTransition(State.RemovingNodes, Event.OperationFailed, State.Running);
113+
99114
s_fsm.addTransition(State.Alert, Event.RecoveryRequested, State.Recovering);
100115
s_fsm.addTransition(State.Recovering, Event.OperationSucceeded, State.Running);
101116
s_fsm.addTransition(State.Recovering, Event.OperationFailed, State.Alert);
@@ -142,4 +157,13 @@ enum State {
142157
Long getMaxSize();
143158
Long getSecurityGroupId();
144159
ClusterType getClusterType();
160+
Long getControlNodeServiceOfferingId();
161+
Long getWorkerNodeServiceOfferingId();
162+
Long getEtcdNodeServiceOfferingId();
163+
Long getControlNodeTemplateId();
164+
Long getWorkerNodeTemplateId();
165+
Long getEtcdNodeTemplateId();
166+
Long getEtcdNodeCount();
167+
Long getCniConfigId();
168+
String getCniConfigDetails();
145169
}

api/src/main/java/com/cloud/kubernetes/cluster/KubernetesServiceHelper.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@
1818

1919
import org.apache.cloudstack.acl.ControlledEntity;
2020

21+
import java.util.Map;
22+
2123
import com.cloud.user.Account;
2224
import com.cloud.uservm.UserVm;
2325
import com.cloud.utils.component.Adapter;
2426

2527
public interface KubernetesServiceHelper extends Adapter {
2628

29+
enum KubernetesClusterNodeType {
30+
CONTROL, WORKER, ETCD, DEFAULT
31+
}
32+
2733
ControlledEntity findByUuid(String uuid);
2834
ControlledEntity findByVmId(long vmId);
2935
void checkVmCanBeDestroyed(UserVm userVm);
36+
boolean isValidNodeType(String nodeType);
37+
Map<String, Long> getServiceOfferingNodeTypeMap(Map<String, Map<String, String>> serviceOfferingNodeTypeMap);
38+
Map<String, Long> getTemplateNodeTypeMap(Map<String, Map<String, String>> templateNodeTypeMap);
3039
void cleanupForAccount(Account account);
3140
}

api/src/main/java/com/cloud/network/NetworkService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,6 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
268268
InternalLoadBalancerElementService getInternalLoadBalancerElementByNetworkServiceProviderId(long networkProviderId);
269269
InternalLoadBalancerElementService getInternalLoadBalancerElementById(long providerId);
270270
List<InternalLoadBalancerElementService> getInternalLoadBalancerElements();
271+
272+
boolean handleCksIsoOnNetworkVirtualRouter(Long virtualRouterId, boolean mount) throws ResourceUnavailableException;
271273
}

api/src/main/java/com/cloud/network/vpc/Vpc.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,6 @@ public enum State {
105105
String getIp6Dns1();
106106

107107
String getIp6Dns2();
108+
109+
boolean useRouterIpAsResolver();
108110
}

api/src/main/java/com/cloud/network/vpc/VpcService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ public interface VpcService {
4848
* @param vpcName
4949
* @param displayText
5050
* @param cidr
51-
* @param networkDomain TODO
51+
* @param networkDomain TODO
5252
* @param ip4Dns1
5353
* @param ip4Dns2
54-
* @param displayVpc TODO
54+
* @param displayVpc TODO
55+
* @param useVrIpResolver
5556
* @return
5657
* @throws ResourceAllocationException TODO
5758
*/
5859
Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
5960
String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu, Integer cidrSize,
60-
Long asNumber, List<Long> bgpPeerIds)
61-
throws ResourceAllocationException;
61+
Long asNumber, List<Long> bgpPeerIds, Boolean useVrIpResolver) throws ResourceAllocationException;
6262

6363
/**
6464
* Persists VPC record in the database

api/src/main/java/com/cloud/server/ManagementService.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@
6262
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
6363
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
6464
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
65+
import org.apache.cloudstack.api.command.user.userdata.DeleteCniConfigurationCmd;
6566
import org.apache.cloudstack.api.command.user.userdata.DeleteUserDataCmd;
6667
import org.apache.cloudstack.api.command.user.userdata.ListUserDataCmd;
68+
import org.apache.cloudstack.api.command.user.userdata.RegisterCniConfigurationCmd;
6769
import org.apache.cloudstack.api.command.user.userdata.RegisterUserDataCmd;
6870
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
6971
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
@@ -369,17 +371,23 @@ public interface ManagementService {
369371
* The api command class.
370372
* @return The list of userdatas found.
371373
*/
372-
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd);
374+
Pair<List<? extends UserData>, Integer> listUserDatas(ListUserDataCmd cmd, boolean forCks);
375+
376+
/**
377+
* Registers a cni configuration.
378+
*
379+
* @param cmd The api command class.
380+
* @return A VO with the registered user data.
381+
*/
382+
UserData registerCniConfiguration(RegisterCniConfigurationCmd cmd);
373383

374384
/**
375385
* Registers a userdata.
376386
*
377-
* @param cmd
378-
* The api command class.
387+
* @param cmd The api command class.
379388
* @return A VO with the registered userdata.
380389
*/
381390
UserData registerUserData(RegisterUserDataCmd cmd);
382-
383391
/**
384392
* Deletes a userdata.
385393
*
@@ -389,6 +397,14 @@ public interface ManagementService {
389397
*/
390398
boolean deleteUserData(DeleteUserDataCmd cmd);
391399

400+
/**
401+
* Deletes user data.
402+
*
403+
* @param cmd
404+
* The api command class.
405+
* @return True on success. False otherwise.
406+
*/
407+
boolean deleteCniConfiguration(DeleteCniConfigurationCmd cmd);
392408
/**
393409
* Search registered key pairs for the logged in user.
394410
*

api/src/main/java/com/cloud/template/TemplateApiService.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,23 @@ public interface TemplateApiService {
5858
VirtualMachineTemplate prepareTemplate(long templateId, long zoneId, Long storageId);
5959

6060

61+
/**
62+
* Detach ISO from VM
63+
* @param vmId id of the VM
64+
* @param isoId id of the ISO (when passed). If it is not passed, it will get it from user_vm table
65+
* @param extraParams forced, isVirtualRouter
66+
* @return true when operation succeeds, false if not
67+
*/
68+
boolean detachIso(long vmId, Long isoId, Boolean... extraParams);
6169

62-
boolean detachIso(long vmId, boolean forced);
63-
64-
boolean attachIso(long isoId, long vmId, boolean forced);
70+
/**
71+
* Attach ISO to a VM
72+
* @param isoId id of the ISO to attach
73+
* @param vmId id of the VM to attach the ISO to
74+
* @param extraParams: forced, isVirtualRouter
75+
* @return true when operation succeeds, false if not
76+
*/
77+
boolean attachIso(long isoId, long vmId, Boolean... extraParams);
6578

6679
/**
6780
* Deletes a template

0 commit comments

Comments
 (0)