Skip to content

Commit d73aac4

Browse files
committed
Merge branch 'apache-main'
2 parents a005f1c + 8853c8f commit d73aac4

1,476 files changed

Lines changed: 60503 additions & 21081 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ tools/cli/cloudmonkey/precache.py
4848
tools/marvin/marvin/cloudstackAPI/
4949
tools/marvin/build/
5050
tools/cli/build/
51+
tools/appliance/systemvmtemplate/packer_cache/
5152
*.jar
5253
*.war
5354
*.mar

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ env:
6464
smoke/test_dynamicroles
6565
smoke/test_global_settings
6666
smoke/test_guest_vlan_range
67-
smoke/test_host_annotations
67+
smoke/test_annotations
6868
smoke/test_host_maintenance
6969
smoke/test_hostha_simulator"
7070

@@ -88,6 +88,7 @@ env:
8888
smoke/test_portable_publicip
8989
smoke/test_portforwardingrules
9090
smoke/test_privategw_acl
91+
smoke/test_privategw_acl_ovs_gre
9192
smoke/test_projects
9293
smoke/test_public_ip_range"
9394

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Apache CloudStack [![Build Status](https://travis-ci.org/apache/cloudstack.svg?branch=main)](https://travis-ci.org/apache/cloudstack) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apachecloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apachecloudstack) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=apachecloudstack&metric=ncloc)](https://sonarcloud.io/dashboard?id=apachecloudstack) ![GitHub language count](https://img.shields.io/github/languages/count/apache/cloudstack.svg) ![GitHub top language](https://img.shields.io/github/languages/top/apache/cloudstack.svg)
1+
# Apache CloudStack [![Build Status](https://app.travis-ci.com/apache/cloudstack.svg?branch=main)](https://app.travis-ci.com/apache/cloudstack) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apachecloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apachecloudstack) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=apachecloudstack&metric=ncloc)](https://sonarcloud.io/dashboard?id=apachecloudstack) ![GitHub language count](https://img.shields.io/github/languages/count/apache/cloudstack.svg) ![GitHub top language](https://img.shields.io/github/languages/top/apache/cloudstack.svg)
22

33
![Apache CloudStack](tools/logo/apache_cloudstack.png)
44

@@ -60,6 +60,7 @@ via Github pull requests.
6060
* Design [documents](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Design)
6161
* API [documentation](https://cloudstack.apache.org/api.html)
6262
* How to [contribute](CONTRIBUTING.md)
63+
* Check the [YouTube channel](https://www.youtube.com/ApacheCloudStack) for presentations, interviews, and more
6364

6465
## Getting Involved and Contributing
6566

@@ -142,5 +143,5 @@ The following provides more details on the included cryptographic software:
142143
* CloudStack makes use of JaSypt cryptographic libraries.
143144
* CloudStack has a system requirement of MySQL, and uses native database encryption functionality.
144145
* CloudStack makes use of the Bouncy Castle general-purpose encryption library.
145-
* CloudStack can optionally interacts with and controls OpenSwan-based VPNs.
146+
* CloudStack can optionally interact with and control OpenSwan-based VPNs.
146147
* CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation.

agent/conf/agent.properties

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ domr.scripts.dir=scripts/network/domr/kvm
9797
# migration will finish quickly. Less than 1 means disabled.
9898
#vm.migrate.pauseafter=0
9999

100+
# Time (in seconds) to wait for VM migrate finish. Less than 1 means disabled.
101+
# If vm migration is not finished in the time, the vm job will be cancelled by libvirt.
102+
# It will be configured by cloudstack management server when cloudstack agent connects.
103+
# please change the global setting 'migratewait' if needed (default value: 3600)
104+
#vm.migrate.wait=0
105+
100106
# Agent hooks is the way to override default agent behavior to extend the functionality without excessive coding
101107
# for a custom deployment. The first hook promoted is libvirt-vm-xml-transformer which allows provider to modify
102108
# VM XML specification before send to libvirt. Hooks are implemented in Groovy and must be implemented in the way
@@ -266,3 +272,16 @@ iscsi.session.cleanup.enabled=false
266272
# Automatically clean up iscsi sessions not attached to any VM.
267273
# Should be enabled for users using managed storage for example solidfire.
268274
# Should be disabled for users with unmanaged iscsi connections on their hosts
275+
276+
# This parameter specifies the heartbeat update timeout in ms; The default value is 60000ms (1 min).
277+
# Depending on the use case, this timeout might need increasing/decreasing.
278+
# heartbeat.update.timeout=60000
279+
280+
# This parameter specifies the timeout in seconds to retrieve the target's domain id when migrating a VM with KVM.
281+
# vm.migrate.domain.retrieve.timeout=10
282+
283+
# This parameter specifies if the host must be rebooted when something goes wrong with the heartbeat.
284+
# reboot.host.and.alert.management.on.heartbeat.timeout=true
285+
286+
# Enable manually setting CPU's topology on KVM's VM.
287+
# enable.manually.setting.cpu.topology.on.kvm.vm=true

agent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>org.apache.cloudstack</groupId>
2626
<artifactId>cloudstack</artifactId>
27-
<version>4.16.0.0-SNAPSHOT</version>
27+
<version>4.17.0.0-SNAPSHOT</version>
2828
</parent>
2929
<dependencies>
3030
<dependency>

agent/src/main/java/com/cloud/agent/Agent.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import org.apache.cloudstack.utils.security.KeyStoreUtils;
5252
import org.apache.commons.collections.CollectionUtils;
5353
import org.apache.commons.io.FileUtils;
54+
import org.apache.commons.lang3.StringUtils;
5455
import org.apache.log4j.Logger;
5556
import org.apache.log4j.MDC;
5657

@@ -72,7 +73,6 @@
7273
import com.cloud.host.Host;
7374
import com.cloud.resource.ServerResource;
7475
import com.cloud.utils.PropertiesUtil;
75-
import com.cloud.utils.StringUtils;
7676
import com.cloud.utils.backoff.BackoffAlgorithm;
7777
import com.cloud.utils.concurrency.NamedThreadFactory;
7878
import com.cloud.utils.exception.CloudRuntimeException;
@@ -85,7 +85,6 @@
8585
import com.cloud.utils.nio.Task;
8686
import com.cloud.utils.script.OutputInterpreter;
8787
import com.cloud.utils.script.Script;
88-
import com.google.common.base.Strings;
8988

9089
/**
9190
* @config
@@ -715,7 +714,7 @@ public Answer setupAgentKeystore(final SetupKeyStoreCommand cmd) {
715714
final String csrFile = agentFile.getParent() + "/" + KeyStoreUtils.CSR_FILENAME;
716715

717716
String storedPassword = _shell.getPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY);
718-
if (Strings.isNullOrEmpty(storedPassword)) {
717+
if (StringUtils.isEmpty(storedPassword)) {
719718
storedPassword = keyStorePassword;
720719
_shell.setPersistentProperty(null, KeyStoreUtils.KS_PASSPHRASE_PROPERTY, storedPassword);
721720
}
@@ -782,9 +781,9 @@ private Answer setupAgentCertificate(final SetupCertificateCommand cmd) {
782781
}
783782

784783
private void processManagementServerList(final List<String> msList, final String lbAlgorithm, final Long lbCheckInterval) {
785-
if (CollectionUtils.isNotEmpty(msList) && !Strings.isNullOrEmpty(lbAlgorithm)) {
784+
if (CollectionUtils.isNotEmpty(msList) && StringUtils.isNotEmpty(lbAlgorithm)) {
786785
try {
787-
final String newMSHosts = String.format("%s%s%s", StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm);
786+
final String newMSHosts = String.format("%s%s%s", com.cloud.utils.StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm);
788787
_shell.setPersistentProperty(null, "host", newMSHosts);
789788
_shell.setHosts(newMSHosts);
790789
_shell.resetHostCounter();

agent/src/main/java/com/cloud/agent/AgentShell.java

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@
1616
// under the License.
1717
package com.cloud.agent;
1818

19+
import com.cloud.agent.Agent.ExitStatus;
20+
import com.cloud.agent.dao.StorageComponent;
21+
import com.cloud.agent.dao.impl.PropertiesStorage;
22+
import com.cloud.resource.ServerResource;
23+
import com.cloud.utils.LogUtils;
24+
import com.cloud.utils.NumbersUtil;
25+
import com.cloud.utils.ProcessUtil;
26+
import com.cloud.utils.PropertiesUtil;
27+
import com.cloud.utils.backoff.BackoffAlgorithm;
28+
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
29+
import com.cloud.utils.exception.CloudRuntimeException;
30+
import org.apache.commons.daemon.Daemon;
31+
import org.apache.commons.daemon.DaemonContext;
32+
import org.apache.commons.daemon.DaemonInitException;
33+
import org.apache.commons.lang.math.NumberUtils;
34+
import org.apache.commons.lang3.StringUtils;
35+
import org.apache.log4j.Logger;
36+
import org.apache.log4j.xml.DOMConfigurator;
37+
38+
import javax.naming.ConfigurationException;
1939
import java.io.File;
2040
import java.io.FileNotFoundException;
2141
import java.io.IOException;
@@ -30,28 +50,6 @@
3050
import java.util.Properties;
3151
import java.util.UUID;
3252

33-
import javax.naming.ConfigurationException;
34-
35-
import org.apache.commons.daemon.Daemon;
36-
import org.apache.commons.daemon.DaemonContext;
37-
import org.apache.commons.daemon.DaemonInitException;
38-
import org.apache.commons.lang.math.NumberUtils;
39-
import org.apache.log4j.Logger;
40-
import org.apache.log4j.xml.DOMConfigurator;
41-
42-
import com.cloud.agent.Agent.ExitStatus;
43-
import com.cloud.agent.dao.StorageComponent;
44-
import com.cloud.agent.dao.impl.PropertiesStorage;
45-
import com.cloud.resource.ServerResource;
46-
import com.cloud.utils.LogUtils;
47-
import com.cloud.utils.NumbersUtil;
48-
import com.cloud.utils.ProcessUtil;
49-
import com.cloud.utils.PropertiesUtil;
50-
import com.cloud.utils.backoff.BackoffAlgorithm;
51-
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
52-
import com.cloud.utils.exception.CloudRuntimeException;
53-
import com.google.common.base.Strings;
54-
5553
public class AgentShell implements IAgentShell, Daemon {
5654
private static final Logger s_logger = Logger.getLogger(AgentShell.class.getName());
5755

@@ -155,7 +153,7 @@ public String[] getHosts() {
155153

156154
@Override
157155
public void setHosts(final String host) {
158-
if (!Strings.isNullOrEmpty(host)) {
156+
if (StringUtils.isNotEmpty(host)) {
159157
_host = host.split(hostLbAlgorithmSeparator)[0];
160158
resetHostCounter();
161159
}
@@ -333,7 +331,7 @@ protected boolean parseCommand(final String[] args) throws ConfigurationExceptio
333331
}
334332

335333
String val = getProperty(null, preferredHostIntervalKey);
336-
preferredHostCheckInterval = (Strings.isNullOrEmpty(val) ? null : Long.valueOf(val));
334+
preferredHostCheckInterval = StringUtils.isEmpty(val) ? null : Long.valueOf(val);
337335

338336
return true;
339337
}
@@ -423,13 +421,13 @@ private void launchAgentFromClassInfo(String resourceClassNames) throws Configur
423421
} catch (final ClassNotFoundException e) {
424422
throw new ConfigurationException("Resource class not found: " + name + " due to: " + e.toString());
425423
} catch (final SecurityException e) {
426-
throw new ConfigurationException("Security excetion when loading resource: " + name + " due to: " + e.toString());
424+
throw new ConfigurationException("Security exception when loading resource: " + name + " due to: " + e.toString());
427425
} catch (final NoSuchMethodException e) {
428-
throw new ConfigurationException("Method not found excetion when loading resource: " + name + " due to: " + e.toString());
426+
throw new ConfigurationException("Method not found exception when loading resource: " + name + " due to: " + e.toString());
429427
} catch (final IllegalArgumentException e) {
430-
throw new ConfigurationException("Illegal argument excetion when loading resource: " + name + " due to: " + e.toString());
428+
throw new ConfigurationException("Illegal argument exception when loading resource: " + name + " due to: " + e.toString());
431429
} catch (final InstantiationException e) {
432-
throw new ConfigurationException("Instantiation excetion when loading resource: " + name + " due to: " + e.toString());
430+
throw new ConfigurationException("Instantiation exception when loading resource: " + name + " due to: " + e.toString());
433431
} catch (final IllegalAccessException e) {
434432
throw new ConfigurationException("Illegal access exception when loading resource: " + name + " due to: " + e.toString());
435433
} catch (final InvocationTargetException e) {

agent/src/main/java/com/cloud/agent/direct/download/DirectTemplateDownloaderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import com.cloud.utils.exception.CloudRuntimeException;
2222
import org.apache.cloudstack.utils.security.DigestHelper;
23-
import org.apache.commons.lang.StringUtils;
23+
import org.apache.commons.lang3.StringUtils;
2424
import org.apache.log4j.Logger;
2525

2626
import java.io.File;

agent/src/main/java/com/cloud/agent/direct/download/MetalinkDirectTemplateDownloader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.cloud.utils.UriUtils;
2323
import com.cloud.utils.exception.CloudRuntimeException;
2424
import org.apache.commons.collections.CollectionUtils;
25-
import org.apache.commons.lang.StringUtils;
25+
import org.apache.commons.lang3.StringUtils;
2626
import org.apache.log4j.Logger;
2727

2828
import java.io.File;
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
package com.cloud.agent.properties;
16+
17+
/**
18+
* Class of constant agent's properties available to configure on
19+
* "agent.properties".
20+
*<br><br>
21+
* Not all available agent properties are defined here, but we should work to
22+
* migrate them on demand to this class.
23+
*
24+
* @param <T> type of the default value.
25+
*/
26+
public class AgentProperties{
27+
28+
/**
29+
* Heartbeat update timeout. <br>
30+
* Data type: int. <br>
31+
* Default value: 60000 (ms).
32+
*/
33+
public static final Property<Integer> HEARTBEAT_UPDATE_TIMEOUT = new Property<Integer>("heartbeat.update.timeout", 60000);
34+
35+
/**
36+
* The timeout in seconds to retrieve the target's domain id when migrating a VM with KVM. <br>
37+
* Data type: int. <br>
38+
* Default value: 10 (sec).
39+
*/
40+
public static final Property<Integer> VM_MIGRATE_DOMAIN_RETRIEVE_TIMEOUT = new Property<Integer>("vm.migrate.domain.retrieve.timeout", 10);
41+
42+
/**
43+
* Reboot host and alert management on heartbeat timeout. <br>
44+
* Data type: boolean.<br>
45+
* Default value: true.
46+
*/
47+
public static final Property<Boolean> REBOOT_HOST_AND_ALERT_MANAGEMENT_ON_HEARTBEAT_TIMEOUT
48+
= new Property<Boolean>("reboot.host.and.alert.management.on.heartbeat.timeout", true);
49+
50+
/**
51+
* Enable manually setting CPU's topology on KVM's VM. <br>
52+
* Data type: boolean.<br>
53+
* Default value: true.
54+
*/
55+
public static final Property<Boolean> ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM = new Property<Boolean>("enable.manually.setting.cpu.topology.on.kvm.vm", true);
56+
57+
public static class Property <T>{
58+
private final String name;
59+
private final T defaultValue;
60+
61+
private Property(String name, T value) {
62+
this.name = name;
63+
this.defaultValue = value;
64+
}
65+
66+
public String getName() {
67+
return name;
68+
}
69+
70+
public T getDefaultValue() {
71+
return defaultValue;
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)