Skip to content

Commit a9c389a

Browse files
committed
Merge remote-tracking branch 'apache/4.20' into scalability-improvements-changes
2 parents f9185cb + cbac6cc commit a9c389a

File tree

61 files changed

+723
-217
lines changed

Some content is hidden

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

61 files changed

+723
-217
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public interface VmDetailConstants {
7474
String ENCRYPTED_PASSWORD = "Encrypted.Password";
7575

7676
String CONFIG_DRIVE_LOCATION = "configDriveLocation";
77+
String LAST_CONFIG_DRIVE_LOCATION = "lastConfigDriveLocation";
7778

7879
String SKIP_DRS = "skipFromDRS";
7980

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.cloud.agent.api.Command;
4848
import com.cloud.agent.api.CreateStoragePoolCommand;
4949
import com.cloud.agent.api.DeleteStoragePoolCommand;
50+
import com.cloud.agent.api.HandleConfigDriveIsoCommand;
5051
import com.cloud.agent.api.MaintainCommand;
5152
import com.cloud.agent.api.MigrateCommand;
5253
import com.cloud.agent.api.ModifySshKeysCommand;
@@ -122,11 +123,10 @@ public int compare(final Object o1, final Object o2) {
122123

123124
public final static String[] s_commandsAllowedInMaintenanceMode = new String[] { MaintainCommand.class.toString(), MigrateCommand.class.toString(),
124125
StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(),
125-
ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(),
126-
CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString(), CheckOnHostCommand.class.toString(),
127-
ModifyTargetsCommand.class.toString(), ModifySshKeysCommand.class.toString(),
128-
CreateStoragePoolCommand.class.toString(), DeleteStoragePoolCommand.class.toString(), ModifyStoragePoolCommand.class.toString(),
129-
SetupMSListCommand.class.toString(), RollingMaintenanceCommand.class.toString(), CleanupPersistentNetworkResourceCommand.class.toString()};
126+
ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(), CleanupNetworkRulesCmd.class.toString(),
127+
CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString(), CheckOnHostCommand.class.toString(), ModifyTargetsCommand.class.toString(),
128+
ModifySshKeysCommand.class.toString(), CreateStoragePoolCommand.class.toString(), DeleteStoragePoolCommand.class.toString(), ModifyStoragePoolCommand.class.toString(),
129+
SetupMSListCommand.class.toString(), RollingMaintenanceCommand.class.toString(), CleanupPersistentNetworkResourceCommand.class.toString(), HandleConfigDriveIsoCommand.class.toString()};
130130
protected final static String[] s_commandsNotAllowedInConnectingMode = new String[] { StartCommand.class.toString(), CreateCommand.class.toString() };
131131
static {
132132
Arrays.sort(s_commandsAllowedInMaintenanceMode);

engine/schema/src/main/java/com/cloud/projects/dao/ProjectAccountDao.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public interface ProjectAccountDao extends GenericDao<ProjectAccountVO, Long> {
4747

4848
void removeAccountFromProjects(long accountId);
4949

50+
void removeUserFromProjects(long userId);
51+
5052
boolean canUserModifyProject(long projectId, long accountId, long userId);
5153

5254
List<ProjectAccountVO> listUsersOrAccountsByRole(long id);

engine/schema/src/main/java/com/cloud/projects/dao/ProjectAccountDaoImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@ public void removeAccountFromProjects(long accountId) {
192192
}
193193
}
194194

195+
@Override
196+
public void removeUserFromProjects(long userId) {
197+
SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();
198+
sc.setParameters("userId", userId);
199+
200+
int removedCount = remove(sc);
201+
if (removedCount > 0) {
202+
logger.debug(String.format("Removed user [%s] from %s project(s).", userId, removedCount));
203+
}
204+
}
205+
195206
@Override
196207
public boolean canUserModifyProject(long projectId, long accountId, long userId) {
197208
SearchCriteria<ProjectAccountVO> sc = AllFieldsSearch.create();

engine/schema/src/main/java/com/cloud/storage/VolumeVO.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,34 @@ public class VolumeVO implements Volume {
4848
@TableGenerator(name = "volume_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "volume_seq", allocationSize = 1)
4949
@GeneratedValue(strategy = GenerationType.TABLE)
5050
@Column(name = "id")
51-
long id;
51+
private long id;
5252

5353
@Column(name = "last_id")
5454
private long lastId;
5555

5656
@Column(name = "name")
57-
String name;
57+
private String name;
5858

5959
@Column(name = "pool_id")
60-
Long poolId;
60+
private Long poolId;
6161

6262
@Column(name = "last_pool_id")
63-
Long lastPoolId;
63+
private Long lastPoolId;
6464

6565
@Column(name = "account_id")
66-
long accountId;
66+
private long accountId;
6767

6868
@Column(name = "domain_id")
69-
long domainId;
69+
private long domainId;
7070

7171
@Column(name = "instance_id")
72-
Long instanceId = null;
72+
private Long instanceId = null;
7373

7474
@Column(name = "device_id")
75-
Long deviceId = null;
75+
private Long deviceId = null;
7676

7777
@Column(name = "size")
78-
Long size;
78+
private Long size;
7979

8080
@Column(name = "min_iops")
8181
private Long minIops;
@@ -84,50 +84,50 @@ public class VolumeVO implements Volume {
8484
private Long maxIops;
8585

8686
@Column(name = "folder")
87-
String folder;
87+
private String folder;
8888

8989
@Column(name = "path")
90-
String path;
90+
private String path;
9191

9292
@Column(name = "pod_id")
93-
Long podId;
93+
private Long podId;
9494

9595
@Column(name = "created")
96-
Date created;
96+
private Date created;
9797

9898
@Column(name = "attached")
9999
@Temporal(value = TemporalType.TIMESTAMP)
100-
Date attached;
100+
private Date attached;
101101

102102
@Column(name = "data_center_id")
103-
long dataCenterId;
103+
private long dataCenterId;
104104

105105
@Column(name = "host_ip")
106-
String hostip;
106+
private String hostIp;
107107

108108
@Column(name = "disk_offering_id")
109-
long diskOfferingId;
109+
private long diskOfferingId;
110110

111111
@Column(name = "template_id")
112-
Long templateId;
112+
private Long templateId;
113113

114114
@Column(name = "first_snapshot_backup_uuid")
115-
String firstSnapshotBackupUuid;
115+
private String firstSnapshotBackupUuid;
116116

117117
@Column(name = "volume_type")
118118
@Enumerated(EnumType.STRING)
119-
Type volumeType = Volume.Type.UNKNOWN;
119+
private Type volumeType = Volume.Type.UNKNOWN;
120120

121121
@Column(name = "pool_type")
122122
@Convert(converter = StoragePoolTypeConverter.class)
123-
StoragePoolType poolType;
123+
private StoragePoolType poolType;
124124

125125
@Column(name = GenericDao.REMOVED_COLUMN)
126-
Date removed;
126+
private Date removed;
127127

128128
@Column(name = "updated")
129129
@Temporal(value = TemporalType.TIMESTAMP)
130-
Date updated;
130+
private Date updated;
131131

132132
@Column(name = "update_count", updatable = true, nullable = false)
133133
protected long updatedCount; // This field should be updated everytime the
@@ -136,17 +136,17 @@ public class VolumeVO implements Volume {
136136
// dao code.
137137

138138
@Column(name = "recreatable")
139-
boolean recreatable;
139+
private boolean recreatable;
140140

141141
@Column(name = "state")
142142
@Enumerated(value = EnumType.STRING)
143143
private State state;
144144

145145
@Column(name = "chain_info", length = 65535)
146-
String chainInfo;
146+
private String chainInfo;
147147

148148
@Column(name = "uuid")
149-
String uuid;
149+
private String uuid;
150150

151151
@Column(name = "format")
152152
private Storage.ImageFormat format;
@@ -171,7 +171,7 @@ public class VolumeVO implements Volume {
171171

172172
@Transient
173173
// @Column(name="reservation")
174-
String reservationId;
174+
private String reservationId;
175175

176176
@Column(name = "hv_ss_reserve")
177177
private Integer hypervisorSnapshotReserve;
@@ -431,11 +431,11 @@ public void setPath(String path) {
431431
}
432432

433433
public String getHostIp() {
434-
return hostip;
434+
return hostIp;
435435
}
436436

437437
public void setHostIp(String hostip) {
438-
this.hostip = hostip;
438+
this.hostIp = hostip;
439439
}
440440

441441
public void setPodId(Long podId) {
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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 com.cloud.upgrade.dao;
18+
19+
import com.cloud.utils.exception.CloudRuntimeException;
20+
21+
import java.io.InputStream;
22+
import java.sql.Connection;
23+
24+
public class Upgrade41910to41920 implements DbUpgrade {
25+
26+
@Override
27+
public String[] getUpgradableVersionRange() {
28+
return new String[]{"4.19.1.0", "4.19.2.0"};
29+
}
30+
31+
@Override
32+
public String getUpgradedVersion() {
33+
return "4.19.2.0";
34+
}
35+
36+
@Override
37+
public boolean supportsRollingUpgrade() {
38+
return false;
39+
}
40+
41+
@Override
42+
public InputStream[] getPrepareScripts() {
43+
final String scriptFile = "META-INF/db/schema-41910to41920.sql";
44+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
45+
if (script == null) {
46+
throw new CloudRuntimeException("Unable to find " + scriptFile);
47+
}
48+
49+
return new InputStream[]{script};
50+
}
51+
52+
@Override
53+
public void performDataMigration(Connection conn) {
54+
}
55+
56+
@Override
57+
public InputStream[] getCleanupScripts() {
58+
final String scriptFile = "META-INF/db/schema-41910to41920-cleanup.sql";
59+
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
60+
if (script == null) {
61+
throw new CloudRuntimeException("Unable to find " + scriptFile);
62+
}
63+
64+
return new InputStream[]{script};
65+
}
66+
}

engine/schema/src/main/resources/META-INF/db/schema-41900to41910.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,3 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.user_data', 'removed', 'datetime COM
7070
UPDATE `cloud`.`configuration` SET
7171
`options` = 'FirstFitRouting,RandomAllocator,TestingAllocator,FirstFitAllocator,RecreateHostAllocator'
7272
WHERE `name` = 'host.allocators.order';
73-
74-
-- Add last_id to the volumes table
75-
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('volumes','last_id', 'bigint(20) unsigned DEFAULT NULL');
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
--;
19+
-- Schema upgrade cleanup from 4.19.1.0 to 4.19.2.0
20+
--;
21+
22+
-- Delete `project_account` entries for users that were removed
23+
DELETE FROM `cloud`.`project_account` WHERE `user_id` IN (SELECT `id` FROM `cloud`.`user` WHERE `removed`);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
--;
19+
-- Schema upgrade from 4.19.1.0 to 4.19.2.0
20+
--;
21+
22+
-- Add last_id to the volumes table
23+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'last_id', 'bigint(20) unsigned DEFAULT NULL');

engine/schema/src/main/resources/META-INF/db/schema-42000to42010.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ CALL `cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY`('cloud.mshost_peer','fk_mshost_peer__
2929
CALL `cloud`.`IDEMPOTENT_DROP_INDEX`('i_mshost_peer__owner_peer_runid','mshost_peer');
3030
CALL `cloud`.`IDEMPOTENT_ADD_UNIQUE_KEY`('cloud.mshost_peer', 'i_mshost_peer__owner_peer', '(owner_mshost, peer_mshost)');
3131
CALL `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.mshost_peer', 'fk_mshost_peer__owner_mshost', '(owner_mshost)', '`mshost`(`id`)');
32+
33+
-- Add last_id to the volumes table
34+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.volumes', 'last_id', 'bigint(20) unsigned DEFAULT NULL');

0 commit comments

Comments
 (0)