Skip to content

Commit db564b1

Browse files
committed
Merge branch '4.19'
2 parents e87c6cf + f25d35c commit db564b1

File tree

23 files changed

+388
-42
lines changed

23 files changed

+388
-42
lines changed

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.apache.cloudstack.ha.HAConfig;
3232
import org.apache.cloudstack.storage.object.Bucket;
3333
import org.apache.cloudstack.storage.object.ObjectStore;
34+
import org.apache.cloudstack.quota.QuotaTariff;
3435
import org.apache.cloudstack.usage.Usage;
3536
import org.apache.cloudstack.vm.schedule.VMSchedule;
3637

@@ -729,6 +730,11 @@ public class EventTypes {
729730
public static final String EVENT_BUCKET_DELETE = "BUCKET.DELETE";
730731
public static final String EVENT_BUCKET_UPDATE = "BUCKET.UPDATE";
731732

733+
// Quota
734+
public static final String EVENT_QUOTA_TARIFF_CREATE = "QUOTA.TARIFF.CREATE";
735+
public static final String EVENT_QUOTA_TARIFF_DELETE = "QUOTA.TARIFF.DELETE";
736+
public static final String EVENT_QUOTA_TARIFF_UPDATE = "QUOTA.TARIFF.UPDATE";
737+
732738
static {
733739

734740
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@@ -1178,6 +1184,11 @@ public class EventTypes {
11781184
entityEventDetails.put(EVENT_BUCKET_CREATE, Bucket.class);
11791185
entityEventDetails.put(EVENT_BUCKET_UPDATE, Bucket.class);
11801186
entityEventDetails.put(EVENT_BUCKET_DELETE, Bucket.class);
1187+
1188+
// Quota
1189+
entityEventDetails.put(EVENT_QUOTA_TARIFF_CREATE, QuotaTariff.class);
1190+
entityEventDetails.put(EVENT_QUOTA_TARIFF_DELETE, QuotaTariff.class);
1191+
entityEventDetails.put(EVENT_QUOTA_TARIFF_UPDATE, QuotaTariff.class);
11811192
}
11821193

11831194
public static String getEntityForEvent(String eventName) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public enum ApiCommandResourceType {
8080
VpnCustomerGateway(com.cloud.network.Site2SiteCustomerGateway.class),
8181
ManagementServer(org.apache.cloudstack.management.ManagementServerHost.class),
8282
ObjectStore(org.apache.cloudstack.storage.object.ObjectStore.class),
83-
Bucket(org.apache.cloudstack.storage.object.Bucket.class);
83+
Bucket(org.apache.cloudstack.storage.object.Bucket.class),
84+
QuotaTariff(org.apache.cloudstack.quota.QuotaTariff.class);
8485

8586
private final Class<?> clazz;
8687

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
// 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+
package org.apache.cloudstack.quota;
19+
20+
import org.apache.cloudstack.api.Identity;
21+
import org.apache.cloudstack.api.InternalIdentity;
22+
23+
public interface QuotaTariff extends InternalIdentity, Identity {
24+
25+
}

engine/schema/src/main/java/com/cloud/network/security/dao/SecurityGroupVMMapDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public List<SecurityGroupVMMapVO> listBySecurityGroup(long securityGroupId, Stat
131131
SearchCriteria<SecurityGroupVMMapVO> sc = ListBySecurityGroupAndStates.create();
132132
sc.setParameters("securityGroupId", securityGroupId);
133133
sc.setParameters("states", (Object[])vmStates);
134-
return listBy(sc, null, true);
134+
return listBy(sc, null);
135135
}
136136

137137
@Override
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 Upgrade41900to41910 implements DbUpgrade {
25+
26+
@Override
27+
public String[] getUpgradableVersionRange() {
28+
return new String[] {"4.19.0.0", "4.19.1.0"};
29+
}
30+
31+
@Override
32+
public String getUpgradedVersion() {
33+
return "4.19.1.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-41900to41910.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-41900to41910-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+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.0.0 to 4.19.1.0
20+
--;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.0.0 to 4.19.1.0
20+
--;
21+
22+
-- Updates the populated Quota tariff's types VM_DISK_BYTES_READ, VM_DISK_BYTES_WRITE, VM_DISK_IO_READ and VM_DISK_IO_WRITE to the correct unit.
23+
24+
UPDATE cloud_usage.quota_tariff
25+
SET usage_unit = 'Bytes', updated_on = NOW()
26+
WHERE effective_on = '2010-05-04 00:00:00'
27+
AND name IN ('VM_DISK_BYTES_READ', 'VM_DISK_BYTES_WRITE');
28+
29+
UPDATE cloud_usage.quota_tariff
30+
SET usage_unit = 'IOPS', updated_on = NOW()
31+
WHERE effective_on = '2010-05-04 00:00:00'
32+
AND name IN ('VM_DISK_IO_READ', 'VM_DISK_IO_WRITE');

framework/db/src/main/java/com/cloud/utils/db/GenericDaoBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,9 +1502,9 @@ public T persist(final T entity) {
15021502
} else {
15031503
_idField.set(entity, id);
15041504
}
1505-
} else {
1506-
id = (ID)_idField.get(entity);
15071505
}
1506+
1507+
id = (ID)_idField.get(entity);
15081508
}
15091509
} catch (final IllegalAccessException e) {
15101510
throw new CloudRuntimeException("Yikes! ", e);

framework/quota/src/main/java/org/apache/cloudstack/quota/dao/QuotaTariffDaoImpl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,14 @@ public QuotaTariffVO findByUuid(String uuid) {
229229

230230
return quotaTariffs.get(0);
231231
}
232+
233+
@Override
234+
public QuotaTariffVO findByIdIncludingRemoved(Long id) {
235+
return Transaction.execute(TransactionLegacy.USAGE_DB, (TransactionCallback<QuotaTariffVO>) status -> super.findByIdIncludingRemoved(id));
236+
}
237+
238+
@Override
239+
public QuotaTariffVO findByUuidIncludingRemoved(String uuid) {
240+
return Transaction.execute(TransactionLegacy.USAGE_DB, (TransactionCallback<QuotaTariffVO>) status -> super.findByUuidIncludingRemoved(uuid));
241+
}
232242
}

framework/quota/src/main/java/org/apache/cloudstack/quota/vo/QuotaTariffVO.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.apache.cloudstack.quota.vo;
1818

1919
import com.cloud.utils.DateUtil;
20-
import org.apache.cloudstack.api.InternalIdentity;
20+
import org.apache.cloudstack.quota.QuotaTariff;
2121
import org.apache.cloudstack.quota.constant.QuotaTypes;
2222
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2323

@@ -40,7 +40,7 @@
4040

4141
@Entity
4242
@Table(name = "quota_tariff")
43-
public class QuotaTariffVO implements InternalIdentity {
43+
public class QuotaTariffVO implements QuotaTariff {
4444
private static final long serialVersionUID = -7117933766387653203L;
4545

4646
@Id
@@ -243,6 +243,7 @@ public String getDescription() {
243243
return description;
244244
}
245245

246+
@Override
246247
public String getUuid() {
247248
return uuid;
248249
}

0 commit comments

Comments
 (0)