Skip to content

Commit fadb39e

Browse files
committed
Merge release branch 4.20 to main
* 4.20: merge errors fixed Restrict the migration of volumes attached to VMs in Starting state (#9725) server, plugin: enhance storage stats for IOPS (#10034) Introducing granular command timeouts global setting (#9659) Improve logging to include more identifiable information (#9873)
2 parents d1cf453 + ab76d3c commit fadb39e

File tree

495 files changed

+6646
-4887
lines changed

Some content is hidden

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

495 files changed

+6646
-4887
lines changed

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

+36-8
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ public int value() {
132132
ServerResource _resource;
133133
Link _link;
134134
Long _id;
135+
String _uuid;
136+
String _name;
135137

136138
Timer _timer = new Timer("Agent Timer");
137139
Timer certTimer;
@@ -182,8 +184,10 @@ public Agent(final IAgentShell shell, final int localAgentId, final ServerResour
182184
resource.setAgentControl(this);
183185

184186
final String value = _shell.getPersistentProperty(getResourceName(), "id");
187+
_uuid = _shell.getPersistentProperty(getResourceName(), "uuid");
188+
_name = _shell.getPersistentProperty(getResourceName(), "name");
185189
_id = value != null ? Long.parseLong(value) : null;
186-
logger.info("id is {}", ObjectUtils.defaultIfNull(_id, ""));
190+
logger.info("Initialising agent [id: {}, uuid: {}, name: {}]", ObjectUtils.defaultIfNull(_id, ""), _uuid, _name);
187191

188192
final Map<String, Object> params = new HashMap<>();
189193

@@ -212,8 +216,9 @@ public Agent(final IAgentShell shell, final int localAgentId, final ServerResour
212216
new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
213217
"agentRequest-Handler"));
214218

215-
logger.info("Agent [id = {} : type = {} : zone = {} : pod = {} : workers = {} : host = {} : port = {}", ObjectUtils.defaultIfNull(_id, "new"), getResourceName(),
216-
_shell.getZone(), _shell.getPod(), _shell.getWorkers(), host, _shell.getPort());
219+
logger.info("Agent [id = {}, uuid: {}, name: {}] : type = {} : zone = {} : pod = {} : workers = {} : host = {} : port = {}",
220+
ObjectUtils.defaultIfNull(_id, "new"), _uuid, _name, getResourceName(),
221+
_shell.getZone(), _shell.getPod(), _shell.getWorkers(), host, _shell.getPort());
217222
}
218223

219224
public String getVersion() {
@@ -377,11 +382,28 @@ public Long getId() {
377382
}
378383

379384
public void setId(final Long id) {
380-
logger.debug("Set agent id {}", id);
381385
_id = id;
382386
_shell.setPersistentProperty(getResourceName(), "id", Long.toString(id));
383387
}
384388

389+
public String getUuid() {
390+
return _uuid;
391+
}
392+
393+
public void setUuid(String uuid) {
394+
this._uuid = uuid;
395+
_shell.setPersistentProperty(getResourceName(), "uuid", uuid);
396+
}
397+
398+
public String getName() {
399+
return _name;
400+
}
401+
402+
public void setName(String name) {
403+
this._name = name;
404+
_shell.setPersistentProperty(getResourceName(), "name", name);
405+
}
406+
385407
private synchronized void scheduleServicesRestartTask() {
386408
if (certTimer != null) {
387409
certTimer.cancel();
@@ -594,17 +616,21 @@ public void processStartupAnswer(final Answer answer, final Response response, f
594616
return;
595617
}
596618

597-
logger.info("Process agent startup answer, agent id = {}", startup.getHostId());
619+
logger.info("Process agent startup answer, agent [id: {}, uuid: {}, name: {}] connected to the server",
620+
startup.getHostId(), startup.getHostUuid(), startup.getHostName());
598621

599622
setId(startup.getHostId());
623+
setUuid(startup.getHostUuid());
624+
setName(startup.getHostName());
600625
_pingInterval = (long)startup.getPingInterval() * 1000; // change to ms.
601626

602627
setLastPingResponseTime();
603628
scheduleWatch(link, response, _pingInterval, _pingInterval);
604629

605630
_ugentTaskPool.setKeepAliveTime(2 * _pingInterval, TimeUnit.MILLISECONDS);
606631

607-
logger.info("Startup Response Received: agent id = {}", getId());
632+
logger.info("Startup Response Received: agent [id: {}, uuid: {}, name: {}]",
633+
startup.getHostId(), startup.getHostUuid(), startup.getHostName());
608634
}
609635

610636
protected void processRequest(final Request request, final Link link) {
@@ -860,15 +886,17 @@ public void processReadyCommand(final Command cmd) {
860886
NumbersUtil.enableHumanReadableSizes = humanReadable;
861887
}
862888

863-
logger.info("Processing agent ready command, agent id = {}", ready.getHostId());
889+
logger.info("Processing agent ready command, agent id = {}, uuid = {}, name = {}", ready.getHostId(), ready.getHostUuid(), ready.getHostName());
864890
if (ready.getHostId() != null) {
865891
setId(ready.getHostId());
892+
setUuid(ready.getHostUuid());
893+
setName(ready.getHostName());
866894
}
867895

868896
verifyAgentArch(ready.getArch());
869897
processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
870898

871-
logger.info("Ready command is processed for agent id = {}", getId());
899+
logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName());
872900
}
873901

874902
private void verifyAgentArch(String arch) {

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

+21-3
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

+8
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

+8
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

+2-1
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

+8
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

+1-1
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

+8
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

+4
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

+1-1
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

api/src/main/java/com/cloud/region/ha/GlobalLoadBalancingRulesService.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.util.List;
2121

22+
import com.cloud.user.Account;
2223
import org.apache.cloudstack.api.command.user.region.ha.gslb.AssignToGlobalLoadBalancerRuleCmd;
2324
import org.apache.cloudstack.api.command.user.region.ha.gslb.CreateGlobalLoadBalancerRuleCmd;
2425
import org.apache.cloudstack.api.command.user.region.ha.gslb.DeleteGlobalLoadBalancerRuleCmd;
@@ -39,7 +40,7 @@ public interface GlobalLoadBalancingRulesService {
3940

4041
GlobalLoadBalancerRule updateGlobalLoadBalancerRule(UpdateGlobalLoadBalancerRuleCmd updateGslbCmd);
4142

42-
boolean revokeAllGslbRulesForAccount(com.cloud.user.Account caller, long accountId) throws com.cloud.exception.ResourceUnavailableException;
43+
boolean revokeAllGslbRulesForAccount(com.cloud.user.Account caller, Account account) throws com.cloud.exception.ResourceUnavailableException;
4344

4445
/*
4546
* methods for managing sites participating in global load balancing

api/src/main/java/com/cloud/storage/StorageStats.java

+3
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ public interface StorageStats {
2626
* @return bytes capacity of the storage server
2727
*/
2828
public long getCapacityBytes();
29+
30+
Long getCapacityIops();
31+
Long getUsedIops();
2932
}

api/src/main/java/com/cloud/vm/NicProfile.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ public void deallocate() {
450450

451451
@Override
452452
public String toString() {
453-
return String.format("NicProfile %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "vmId", "deviceId", "broadcastUri", "reservationId", "iPv4Address"));
453+
return String.format("NicProfile %s",
454+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
455+
this, "id", "uuid", "vmId", "deviceId",
456+
"broadcastUri", "reservationId", "iPv4Address"));
454457
}
455458
}

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

+1
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ public class ApiConstants {
509509
public static final String URL = "url";
510510
public static final String USAGE_INTERFACE = "usageinterface";
511511
public static final String USED_SUBNETS = "usedsubnets";
512+
public static final String USED_IOPS = "usediops";
512513
public static final String USER_DATA = "userdata";
513514

514515
public static final String USER_DATA_NAME = "userdataname";

api/src/main/java/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ public void execute() {
125125
hostResponse.setResponseName(getCommandName());
126126
this.setResponseObject(hostResponse);
127127
} catch (Exception e) {
128-
logger.debug("Failed to update host:" + getId(), e);
129-
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
128+
Host host = _entityMgr.findById(Host.class, getId());
129+
logger.debug("Failed to update host: {} with id {}", host, getId(), e);
130+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("Failed to update host: %s with id %d, %s", host, getId(), e.getMessage()));
130131
}
131132
}
132133
}

0 commit comments

Comments
 (0)