Skip to content

Commit 802d8b7

Browse files
committed
Merge remote-tracking branch 'apache/4.20' into scalability-improvements-changes
2 parents f83b21d + 2300c1c commit 802d8b7

File tree

507 files changed

+8984
-5371
lines changed

Some content is hidden

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

507 files changed

+8984
-5371
lines changed

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

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.apache.cloudstack.utils.security.KeyStoreUtils;
5757
import org.apache.commons.collections.CollectionUtils;
5858
import org.apache.commons.io.FileUtils;
59+
import org.apache.commons.lang3.ObjectUtils;
5960
import org.apache.commons.lang3.StringUtils;
6061
import org.apache.logging.log4j.LogManager;
6162
import org.apache.logging.log4j.Logger;
@@ -135,6 +136,8 @@ public int value() {
135136
ServerResource serverResource;
136137
Link link;
137138
Long id;
139+
String _uuid;
140+
String _name;
138141

139142
ScheduledExecutorService selfTaskExecutor;
140143
ScheduledExecutorService certExecutor;
@@ -219,9 +222,12 @@ public Agent(final IAgentShell shell, final int localAgentId, final ServerResour
219222
serverResource = resource;
220223
link = null;
221224
resource.setAgentControl(this);
222-
final String value = this.shell.getPersistentProperty(getResourceName(), "id");
225+
final String value = shell.getPersistentProperty(getResourceName(), "id");
226+
_uuid = shell.getPersistentProperty(getResourceName(), "uuid");
227+
_name = shell.getPersistentProperty(getResourceName(), "name");
223228
id = value != null ? Long.parseLong(value) : null;
224-
logger.info("id is {}", (id != null ? id : ""));
229+
logger.info("Initialising agent [id: {}, uuid: {}, name: {}]", ObjectUtils.defaultIfNull(id, ""), _uuid, _name);
230+
225231
final Map<String, Object> params = new HashMap<>();
226232
// merge with properties from command line to let resource access command line parameters
227233
for (final Map.Entry<String, Object> cmdLineProp : this.shell.getCmdLineProperties().entrySet()) {
@@ -238,15 +244,17 @@ public Agent(final IAgentShell shell, final int localAgentId, final ServerResour
238244
logger.info("{} with host = {}, local id = {}", this, host, localAgentId);
239245
}
240246

247+
241248
@Override
242249
public String toString() {
243-
return String.format("Agent [id = %s, type = %s, zone = %s, pod = %s, workers = %d, host = %s, port = %d]",
244-
(id != null ? String.valueOf(id) : "new"),
250+
return String.format("Agent [id = %s, uuid = %s, name = %s, type = %s, zone = %s, pod = %s, workers = %d, port = %d]",
251+
ObjectUtils.defaultIfNull(id, "new"),
252+
_uuid,
253+
_name,
245254
getResourceName(),
246255
this.shell.getZone(),
247256
this.shell.getPod(),
248257
this.shell.getWorkers(),
249-
this.shell.getNextHost(),
250258
this.shell.getPort());
251259
}
252260

@@ -406,6 +414,24 @@ public void setId(final Long id) {
406414
shell.setPersistentProperty(getResourceName(), "id", Long.toString(id));
407415
}
408416

417+
public String getUuid() {
418+
return _uuid;
419+
}
420+
421+
public void setUuid(String uuid) {
422+
this._uuid = uuid;
423+
shell.setPersistentProperty(getResourceName(), "uuid", uuid);
424+
}
425+
426+
public String getName() {
427+
return _name;
428+
}
429+
430+
public void setName(String name) {
431+
this._name = name;
432+
shell.setPersistentProperty(getResourceName(), "name", name);
433+
}
434+
409435
private void scheduleCertificateRenewalTask() {
410436
String name = "CertificateRenewalTask";
411437
if (certExecutor != null && !certExecutor.isShutdown()) {
@@ -655,17 +681,21 @@ public void processStartupAnswer(final Answer answer, final Response response, f
655681
return;
656682
}
657683

658-
logger.info("Process agent startup answer, agent id = {}", startup.getHostId());
684+
logger.info("Process agent startup answer, agent [id: {}, uuid: {}, name: {}] connected to the server",
685+
startup.getHostId(), startup.getHostUuid(), startup.getHostName());
659686

660687
setId(startup.getHostId());
688+
setUuid(startup.getHostUuid());
689+
setName(startup.getHostName());
661690
pingInterval = startup.getPingInterval() * 1000L; // change to ms.
662691

663692
updateLastPingResponseTime();
664693
scheduleWatch(link, response, pingInterval, pingInterval);
665694

666695
outRequestHandler.setKeepAliveTime(2 * pingInterval, TimeUnit.MILLISECONDS);
667696

668-
logger.info("Startup Response Received: agent id = {}", getId());
697+
logger.info("Startup Response Received: agent [id: {}, uuid: {}, name: {}]",
698+
startup.getHostId(), startup.getHostUuid(), startup.getHostName());
669699
}
670700

671701
protected void processRequest(final Request request, final Link link) {
@@ -921,15 +951,17 @@ public void processReadyCommand(final Command cmd) {
921951
NumbersUtil.enableHumanReadableSizes = humanReadable;
922952
}
923953

924-
logger.info("Processing agent ready command, agent id = {}", ready.getHostId());
954+
logger.info("Processing agent ready command, agent id = {}, uuid = {}, name = {}", ready.getHostId(), ready.getHostUuid(), ready.getHostName());
925955
if (ready.getHostId() != null) {
926956
setId(ready.getHostId());
957+
setUuid(ready.getHostUuid());
958+
setName(ready.getHostName());
927959
}
928960

929961
verifyAgentArch(ready.getArch());
930962
processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
931963

932-
logger.info("Ready command is processed for agent id = {}", getId());
964+
logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName());
933965
}
934966

935967
private void verifyAgentArch(String arch) {

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,15 @@ public String getMonitorState() {
374374
public static class CounterTO implements Serializable {
375375
private static final long serialVersionUID = 2L;
376376
private final Long id;
377+
private final String uuid;
377378
private final String name;
378379
private final Counter.Source source;
379380
private final String value;
380381
private final String provider;
381382

382-
public CounterTO(Long id, String name, Counter.Source source, String value, String provider) {
383+
public CounterTO(Long id, String uuid, String name, Counter.Source source, String value, String provider) {
383384
this.id = id;
385+
this.uuid = uuid;
384386
this.name = name;
385387
this.source = source;
386388
this.value = value;
@@ -391,6 +393,10 @@ public Long getId() {
391393
return id;
392394
}
393395

396+
public String getUuid() {
397+
return uuid;
398+
}
399+
394400
public String getName() {
395401
return name;
396402
}
@@ -411,12 +417,14 @@ public String getProvider() {
411417
public static class ConditionTO implements Serializable {
412418
private static final long serialVersionUID = 2L;
413419
private final Long id;
420+
private final String uuid;
414421
private final long threshold;
415422
private final Condition.Operator relationalOperator;
416423
private final CounterTO counter;
417424

418-
public ConditionTO(Long id, long threshold, Condition.Operator relationalOperator, CounterTO counter) {
425+
public ConditionTO(Long id, String uuid, long threshold, Condition.Operator relationalOperator, CounterTO counter) {
419426
this.id = id;
427+
this.uuid = uuid;
420428
this.threshold = threshold;
421429
this.relationalOperator = relationalOperator;
422430
this.counter = counter;
@@ -426,6 +434,10 @@ public Long getId() {
426434
return id;
427435
}
428436

437+
public String getUuid() {
438+
return uuid;
439+
}
440+
429441
public long getThreshold() {
430442
return threshold;
431443
}
@@ -442,15 +454,17 @@ public CounterTO getCounter() {
442454
public static class AutoScalePolicyTO implements Serializable {
443455
private static final long serialVersionUID = 2L;
444456
private final long id;
457+
private final String uuid;
445458
private final int duration;
446459
private final int quietTime;
447460
private final Date lastQuietTime;
448461
private AutoScalePolicy.Action action;
449462
boolean revoked;
450463
private final List<ConditionTO> conditions;
451464

452-
public AutoScalePolicyTO(long id, int duration, int quietTime, Date lastQuietTime, AutoScalePolicy.Action action, List<ConditionTO> conditions, boolean revoked) {
465+
public AutoScalePolicyTO(long id, String uuid, int duration, int quietTime, Date lastQuietTime, AutoScalePolicy.Action action, List<ConditionTO> conditions, boolean revoked) {
453466
this.id = id;
467+
this.uuid = uuid;
454468
this.duration = duration;
455469
this.quietTime = quietTime;
456470
this.lastQuietTime = lastQuietTime;
@@ -463,6 +477,10 @@ public long getId() {
463477
return id;
464478
}
465479

480+
public String getUuid() {
481+
return uuid;
482+
}
483+
466484
public int getDuration() {
467485
return duration;
468486
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.cloud.agent.api.to;
1818

1919
import com.cloud.storage.DataStoreRole;
20+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2021

2122
public class NfsTO implements DataStoreTO {
2223

@@ -41,6 +42,13 @@ public NfsTO(String url, DataStoreRole role) {
4142

4243
}
4344

45+
@Override
46+
public String toString() {
47+
return String.format("NfsTO %s",
48+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
49+
this, "uuid", "_url", "_role", "nfsVersion"));
50+
}
51+
4452
@Override
4553
public String getUrl() {
4654
return _url;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.cloud.agent.api.LogLevel.Log4jLevel;
2323
import com.cloud.storage.DataStoreRole;
2424
import com.cloud.utils.storage.S3.ClientOptions;
25+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2526

2627
public final class S3TO implements ClientOptions, DataStoreTO {
2728

@@ -68,6 +69,13 @@ public S3TO(final Long id, final String uuid, final String accessKey, final Stri
6869

6970
}
7071

72+
@Override
73+
public String toString() {
74+
return String.format("S3TO %s",
75+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
76+
this, "id", "uuid", "bucketName"));
77+
}
78+
7179
public Long getId() {
7280
return this.id;
7381
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.cloud.agent.api.LogLevel;
2020
import com.cloud.storage.Storage.StoragePoolType;
2121
import com.cloud.storage.StoragePool;
22+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2223

2324
public class StorageFilerTO {
2425
long id;
@@ -73,6 +74,6 @@ protected StorageFilerTO() {
7374

7475
@Override
7576
public String toString() {
76-
return new StringBuilder("Pool[").append(id).append("|").append(host).append(":").append(port).append("|").append(path).append("]").toString();
77+
return String.format("Pool %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "uuid", "host", "port", "path"));
7778
}
7879
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.cloud.storage.DataStoreRole;
2020
import com.cloud.utils.SwiftUtil;
21+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2122

2223
public class SwiftTO implements DataStoreTO, SwiftUtil.SwiftClientCfg {
2324
Long id;
@@ -41,6 +42,13 @@ public SwiftTO(Long id, String url, String account, String userName, String key,
4142
this.storagePolicy = storagePolicy;
4243
}
4344

45+
@Override
46+
public String toString() {
47+
return String.format("SwiftTO %s",
48+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
49+
this, "id", "account", "userName"));
50+
}
51+
4452
public Long getId() {
4553
return id;
4654
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public interface Ipv6Service extends PluggableService, Configurable {
5858

5959
Pair<Integer, Integer> getUsedTotalIpv6SubnetForZone(long zoneId);
6060

61-
Pair<String, String> preAllocateIpv6SubnetForNetwork(long zoneId) throws ResourceAllocationException;
61+
Pair<String, String> preAllocateIpv6SubnetForNetwork(DataCenter zone) throws ResourceAllocationException;
6262

6363
void assignIpv6SubnetToNetwork(String subnet, long networkId);
6464

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.cloud.network.Networks.BroadcastDomainType;
2323
import com.cloud.network.Networks.Mode;
2424
import com.cloud.network.Networks.TrafficType;
25+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2526

2627
public class NetworkProfile implements Network {
2728
private final long id;
@@ -384,4 +385,11 @@ public Integer getNetworkCidrSize() {
384385
return networkCidrSize;
385386
}
386387

388+
@Override
389+
public String toString() {
390+
return String.format("NetworkProfile %s",
391+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
392+
this, "id", "uuid", "name", "networkOfferingId"));
393+
}
394+
387395
}

api/src/main/java/com/cloud/network/lb/LoadBalancingRule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ public long getId() {
6363
return lb.getId();
6464
}
6565

66+
public LoadBalancer getLb() {
67+
return lb;
68+
}
69+
6670
public String getName() {
6771
return lb.getName();
6872
}

api/src/main/java/com/cloud/network/vpn/RemoteAccessVpnService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface RemoteAccessVpnService {
3939

4040
VpnUser addVpnUser(long vpnOwnerId, String userName, String password);
4141

42-
boolean removeVpnUser(long vpnOwnerId, String userName, Account caller);
42+
boolean removeVpnUser(Account vpnOwner, String userName, Account caller);
4343

4444
List<? extends VpnUser> listVpnUsers(long vpnOwnerId, String userName);
4545

0 commit comments

Comments
 (0)