Skip to content

Commit 564d2b4

Browse files
committed
Merge remote-tracking branch 'upstream/4.20' into apik
2 parents 4da3265 + 58138f2 commit 564d2b4

35 files changed

+1123
-87
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public interface ManagementServerHostStats {
3232

3333
String getManagementServerHostUuid();
3434

35+
long getManagementServerRunId();
36+
3537
long getSessions();
3638

3739
double getCpuUtilization();

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,14 @@ public class ApiConstants {
382382
public static final String PATH = "path";
383383
public static final String PAYLOAD = "payload";
384384
public static final String PAYLOAD_URL = "payloadurl";
385+
public static final String PEERS = "peers";
386+
public static final String PEER_ID = "peerid";
387+
public static final String PEER_NAME = "peername";
388+
public static final String PEER_MSID = "peermsid";
389+
public static final String PEER_RUNID = "peerrunid";
390+
public static final String PEER_SERVICE_IP = "peerserviceip";
391+
public static final String PEER_SERVICE_PORT = "peerserviceport";
392+
public static final String PEER_STATE = "peerstate";
385393
public static final String POD_ID = "podid";
386394
public static final String POD_NAME = "podname";
387395
public static final String POD_IDS = "podids";

api/src/main/java/org/apache/cloudstack/api/command/admin/management/ListMgmtsCmd.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.cloudstack.api.Parameter;
2424
import org.apache.cloudstack.api.response.ListResponse;
2525
import org.apache.cloudstack.api.response.ManagementServerResponse;
26+
import org.apache.commons.lang3.BooleanUtils;
2627

2728
@APICommand(name = "listManagementServers", description = "Lists management servers.", responseObject = ManagementServerResponse.class,
2829
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@@ -39,6 +40,11 @@ public class ListMgmtsCmd extends BaseListCmd {
3940
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the management server")
4041
private String hostName;
4142

43+
@Parameter(name = ApiConstants.PEERS, type = CommandType.BOOLEAN,
44+
description = "Whether to return the management server peers or not. By default, the management server peers will not be returned.",
45+
since = "4.20.0.0")
46+
private Boolean peers;
47+
4248
/////////////////////////////////////////////////////
4349
/////////////////// Accessors ///////////////////////
4450
/////////////////////////////////////////////////////
@@ -51,6 +57,10 @@ public String getHostName() {
5157
return hostName;
5258
}
5359

60+
public Boolean getPeers() {
61+
return BooleanUtils.toBooleanDefaultIfNull(peers, false);
62+
}
63+
5464
/////////////////////////////////////////////////////
5565
/////////////// API Implementation///////////////////
5666
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public class ResizeVolumeCmd extends BaseAsyncCmd implements UserCmd {
7373
description = "new disk offering id")
7474
private Long newDiskOfferingId;
7575

76+
@Parameter(name = ApiConstants.AUTO_MIGRATE, type = CommandType.BOOLEAN, required = false,
77+
description = "Flag to allow automatic migration of the volume to another suitable storage pool that accommodates the new size", since = "4.20.1")
78+
private Boolean autoMigrate;
79+
7680
/////////////////////////////////////////////////////
7781
/////////////////// Accessors ///////////////////////
7882
/////////////////////////////////////////////////////
@@ -129,6 +133,10 @@ public Long getNewDiskOfferingId() {
129133
return newDiskOfferingId;
130134
}
131135

136+
public boolean getAutoMigrate() {
137+
return autoMigrate == null ? false : autoMigrate;
138+
}
139+
132140
/////////////////////////////////////////////////////
133141
/////////////// API Implementation///////////////////
134142
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/response/ManagementServerResponse.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import org.apache.cloudstack.api.EntityReference;
2525
import org.apache.cloudstack.management.ManagementServerHost.State;
2626

27+
import java.util.ArrayList;
2728
import java.util.Date;
29+
import java.util.List;
2830

2931
@EntityReference(value = ManagementServerHost.class)
3032
public class ManagementServerResponse extends BaseResponse {
@@ -76,6 +78,10 @@ public class ManagementServerResponse extends BaseResponse {
7678
@Param(description = "the IP Address for this Management Server")
7779
private String serviceIp;
7880

81+
@SerializedName(ApiConstants.PEERS)
82+
@Param(description = "the Management Server Peers")
83+
private List<PeerManagementServerNodeResponse> peers;
84+
7985
public String getId() {
8086
return this.id;
8187
}
@@ -171,4 +177,19 @@ public void setServiceIp(String serviceIp) {
171177
public String getKernelVersion() {
172178
return kernelVersion;
173179
}
180+
181+
public List<PeerManagementServerNodeResponse> getPeers() {
182+
return peers;
183+
}
184+
185+
public void setPeers(List<PeerManagementServerNodeResponse> peers) {
186+
this.peers = peers;
187+
}
188+
189+
public void addPeer(PeerManagementServerNodeResponse peer) {
190+
if (peers == null) {
191+
peers = new ArrayList<>();
192+
}
193+
peers.add(peer);
194+
}
174195
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.response;
18+
19+
import com.cloud.serializer.Param;
20+
import com.google.gson.annotations.SerializedName;
21+
import org.apache.cloudstack.api.ApiConstants;
22+
import org.apache.cloudstack.api.BaseResponse;
23+
import org.apache.cloudstack.management.ManagementServerHost.State;
24+
25+
import java.util.Date;
26+
27+
public class PeerManagementServerNodeResponse extends BaseResponse {
28+
29+
@SerializedName(ApiConstants.STATE)
30+
@Param(description = "the state of the management server peer")
31+
private State state;
32+
33+
@SerializedName(ApiConstants.LAST_UPDATED)
34+
@Param(description = "the last updated time of the management server peer state")
35+
private Date lastUpdated;
36+
37+
@SerializedName(ApiConstants.PEER_ID)
38+
@Param(description = "the ID of the peer management server")
39+
private String peerId;
40+
41+
@SerializedName(ApiConstants.PEER_NAME)
42+
@Param(description = "the name of the peer management server")
43+
private String peerName;
44+
45+
@SerializedName(ApiConstants.PEER_MSID)
46+
@Param(description = "the management ID of the peer management server")
47+
private String peerMsId;
48+
49+
@SerializedName(ApiConstants.PEER_RUNID)
50+
@Param(description = "the run ID of the peer management server")
51+
private String peerRunId;
52+
53+
@SerializedName(ApiConstants.PEER_STATE)
54+
@Param(description = "the state of the peer management server")
55+
private String peerState;
56+
57+
@SerializedName(ApiConstants.PEER_SERVICE_IP)
58+
@Param(description = "the IP Address for the peer Management Server")
59+
private String peerServiceIp;
60+
61+
@SerializedName(ApiConstants.PEER_SERVICE_PORT)
62+
@Param(description = "the service port for the peer Management Server")
63+
private String peerServicePort;
64+
65+
public void setState(State state) {
66+
this.state = state;
67+
}
68+
69+
public void setLastUpdated(Date lastUpdated) {
70+
this.lastUpdated = lastUpdated;
71+
}
72+
73+
public void setPeerId(String peerId) {
74+
this.peerId = peerId;
75+
}
76+
77+
public void setPeerName(String peerName) {
78+
this.peerName = peerName;
79+
}
80+
81+
public void setPeerMsId(String peerMsId) {
82+
this.peerMsId = peerMsId;
83+
}
84+
85+
public void setPeerRunId(String peerRunId) {
86+
this.peerRunId = peerRunId;
87+
}
88+
89+
public void setPeerState(String peerState) {
90+
this.peerState = peerState;
91+
}
92+
93+
public void setPeerServiceIp(String peerServiceIp) {
94+
this.peerServiceIp = peerServiceIp;
95+
}
96+
97+
public void setPeerServicePort(String peerServicePort) {
98+
this.peerServicePort = peerServicePort;
99+
}
100+
}

engine/components-api/src/main/java/com/cloud/capacity/CapacityManager.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public interface CapacityManager {
4040
static final String StorageCapacityDisableThresholdCK = "pool.storage.capacity.disablethreshold";
4141
static final String StorageOverprovisioningFactorCK = "storage.overprovisioning.factor";
4242
static final String StorageAllocatedCapacityDisableThresholdCK = "pool.storage.allocated.capacity.disablethreshold";
43+
static final String StorageAllocatedCapacityDisableThresholdForVolumeResizeCK = "pool.storage.allocated.resize.capacity.disablethreshold";
4344

4445
static final ConfigKey<Float> CpuOverprovisioningFactor =
4546
new ConfigKey<>(
@@ -118,6 +119,17 @@ public interface CapacityManager {
118119
"Percentage (as a value between 0 and 1) of secondary storage capacity threshold.",
119120
true);
120121

122+
static final ConfigKey<Double> StorageAllocatedCapacityDisableThresholdForVolumeSize =
123+
new ConfigKey<>(
124+
ConfigKey.CATEGORY_ALERT,
125+
Double.class,
126+
StorageAllocatedCapacityDisableThresholdForVolumeResizeCK,
127+
"0.90",
128+
"Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for volume resize. " +
129+
"This is applicable only when volume.resize.allowed.beyond.allocation is set to true.",
130+
true,
131+
ConfigKey.Scope.Zone);
132+
121133
public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId);
122134

123135
void allocateVmCapacity(VirtualMachine vm, boolean fromLastHost);

engine/components-api/src/main/java/com/cloud/storage/StorageManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ public interface StorageManager extends StorageService {
209209
ConfigKey<Long> HEURISTICS_SCRIPT_TIMEOUT = new ConfigKey<>("Advanced", Long.class, "heuristics.script.timeout", "3000",
210210
"The maximum runtime, in milliseconds, to execute the heuristic rule; if it is reached, a timeout will happen.", true);
211211

212+
ConfigKey<Boolean> AllowVolumeReSizeBeyondAllocation = new ConfigKey<Boolean>("Advanced", Boolean.class, "volume.resize.allowed.beyond.allocation", "false",
213+
"Determines whether volume size can exceed the pool capacity allocation disable threshold (pool.storage.allocated.capacity.disablethreshold) " +
214+
"when resize a volume upto resize capacity disable threshold (pool.storage.allocated.resize.capacity.disablethreshold)",
215+
true, ConfigKey.Scope.Zone);
216+
212217
/**
213218
* should we execute in sequence not involving any storages?
214219
* @return tru if commands should execute in sequence

engine/schema/src/main/resources/META-INF/cloudstack/core/spring-engine-schema-core-daos-context.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
<bean id="loadBalancerCertMapDaoImpl" class="com.cloud.network.dao.LoadBalancerCertMapDaoImpl" />
118118
<bean id="managementServerHostDaoImpl" class="com.cloud.cluster.dao.ManagementServerHostDaoImpl" />
119119
<bean id="managementServerHostPeerDaoImpl" class="com.cloud.cluster.dao.ManagementServerHostPeerDaoImpl" />
120+
<bean id="managementServerHostPeerJoinDaoImpl" class="com.cloud.cluster.dao.ManagementServerHostPeerJoinDaoImpl" />
120121
<bean id="managementServerStatusDaoImpl" class="com.cloud.cluster.dao.ManagementServerStatusDaoImpl" />
121122
<bean id="networkAccountDaoImpl" class="com.cloud.network.dao.NetworkAccountDaoImpl" />
122123
<bean id="networkACLDaoImpl" class="com.cloud.network.vpc.dao.NetworkACLDaoImpl" />
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`;
19+
20+
CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY` (
21+
IN in_table_name VARCHAR(200)
22+
, IN in_key_name VARCHAR(200)
23+
, IN in_foreign_key VARCHAR(200)
24+
, IN in_references VARCHAR(1000)
25+
)
26+
BEGIN
27+
28+
DECLARE CONTINUE HANDLER FOR 1061 BEGIN END; SET @ddl = CONCAT_WS(' ', 'ALTER TABLE ', in_table_name, ' ADD CONSTRAINT ', in_key_name, ' FOREIGN KEY ', in_foreign_key, ' REFERENCES ', in_references, ' ON DELETE CASCADE'); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END;

0 commit comments

Comments
 (0)