Skip to content

Commit abe71b1

Browse files
authored
Merge branch 'main' into validate-dependabot
2 parents 2119d8d + 72014a0 commit abe71b1

82 files changed

Lines changed: 4002 additions & 297 deletions

File tree

Some content is hidden

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

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,14 @@ updates:
4141
interval: "daily"
4242
cooldown:
4343
default-days: 7
44+
- package-ecosystem: "pre-commit"
45+
directory: "/"
46+
open-pull-requests-limit: 2
47+
schedule:
48+
interval: "weekly"
49+
groups:
50+
pre-commit-hooks:
51+
patterns:
52+
- "*"
53+
cooldown:
54+
default-days: 7

PendingReleaseNotes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,17 @@ example.ver.1 > example.ver.2:
3939
which can now be attached to Instances. This is to prevent the Secondary
4040
Storage to grow to enormous sizes as Linux Distributions keep growing in
4141
size while a stripped down Linux should fit on a 2.88MB floppy.
42+
43+
4.22.0.0 > 4.22.0.1:
44+
* Disk-only instance snapshots for KVM UEFI VMs now include a sidecar copy of
45+
the active NVRAM state so revert operations restore both disk and firmware
46+
boot state consistently.
47+
48+
* UEFI disk-only instance snapshots taken before this change do not contain an
49+
NVRAM sidecar and cannot be safely reverted. Take a new snapshot after
50+
upgrading before relying on revert for UEFI VMs.
51+
52+
* Taking a disk-only instance snapshot for KVM UEFI VMs now briefly suspends
53+
the guest while the NVRAM sidecar is copied, so that the captured firmware
54+
state is consistent with the disk snapshot. Non-UEFI VMs are unaffected and
55+
continue to snapshot live.

api/src/main/java/com/cloud/host/Host.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public static String[] toStrings(Host.Type... types) {
5555
}
5656

5757
String HOST_UEFI_ENABLE = "host.uefi.enable";
58+
String HOST_KVM_DISK_ONLY_VM_SNAPSHOT_NVRAM = "host.kvm.diskonlyvmsnapshot.nvram";
5859
String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
5960
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
6061
String HOST_VDDK_SUPPORT = "host.vddk.support";

api/src/main/java/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
import com.cloud.uservm.UserVm;
3737
import com.cloud.vm.snapshot.VMSnapshot;
3838

39-
@APICommand(name = "createVMSnapshot", description = "Creates Snapshot for an Instance.", responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class},
39+
@APICommand(name = "createVMSnapshot", description = "Creates Snapshot for an Instance. Running KVM UEFI disk-only snapshots briefly suspend the Instance while copying NVRAM state.",
40+
responseObject = VMSnapshotResponse.class, since = "4.2.0", entityType = {VMSnapshot.class},
4041
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
4142
public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
4243

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.response;
1818

19+
import java.util.Objects;
20+
1921
import com.google.gson.annotations.SerializedName;
2022

2123
import org.apache.cloudstack.api.BaseResponse;
@@ -81,7 +83,7 @@ public boolean equals(Object obj) {
8183
return false;
8284
} else if (!oid.equals(other.getName()))
8385
return false;
84-
else if (this.getValue().equals(other.getValue()))
86+
else if (!Objects.equals(this.getValue(), other.getValue()))
8587
return false;
8688
return true;
8789
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public class NetworkOfferingResponse extends BaseResponseWithAnnotations {
9191
@Param(description = "The ID of the service offering used by virtual router provider")
9292
private String serviceOfferingId;
9393

94+
@SerializedName(ApiConstants.SERVICE_OFFERING_NAME)
95+
@Param(description = "the name of the service offering used by virtual router provider")
96+
private String serviceOfferingName;
97+
9498
@SerializedName(ApiConstants.SERVICE)
9599
@Param(description = "The list of supported services", responseObject = ServiceResponse.class)
96100
private List<ServiceResponse> services;
@@ -330,4 +334,12 @@ public String getRoutingMode() {
330334
public void setRoutingMode(String routingMode) {
331335
this.routingMode = routingMode;
332336
}
337+
338+
public String getServiceOfferingName() {
339+
return serviceOfferingName;
340+
}
341+
342+
public void setServiceOfferingName(String serviceOfferingName) {
343+
this.serviceOfferingName = serviceOfferingName;
344+
}
333345
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ public void setNetworkAvailable(String networkAvailable) {
452452

453453
@Override
454454
public void setVpcLimit(String vpcLimit) {
455-
this.vpcLimit = networkLimit;
455+
this.vpcLimit = vpcLimit;
456456
}
457457

458458
@Override
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 org.junit.Assert;
20+
import org.junit.Test;
21+
22+
public class ImageStoreDetailResponseTest {
23+
24+
@Test
25+
public void equalsIsTrueForSameNameAndValue() {
26+
ImageStoreDetailResponse a = new ImageStoreDetailResponse("key", "value");
27+
ImageStoreDetailResponse b = new ImageStoreDetailResponse("key", "value");
28+
Assert.assertEquals(a, b);
29+
Assert.assertEquals(a.hashCode(), b.hashCode());
30+
}
31+
32+
@Test
33+
public void equalsIsFalseWhenValueDiffers() {
34+
ImageStoreDetailResponse a = new ImageStoreDetailResponse("key", "value");
35+
ImageStoreDetailResponse c = new ImageStoreDetailResponse("key", "other");
36+
Assert.assertNotEquals(a, c);
37+
}
38+
39+
@Test
40+
public void equalsIsFalseWhenNameDiffers() {
41+
ImageStoreDetailResponse a = new ImageStoreDetailResponse("key", "value");
42+
ImageStoreDetailResponse d = new ImageStoreDetailResponse("other", "value");
43+
Assert.assertNotEquals(a, d);
44+
}
45+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 org.junit.Assert;
20+
import org.junit.Test;
21+
import org.springframework.test.util.ReflectionTestUtils;
22+
23+
public class ProjectResponseTest {
24+
25+
@Test
26+
public void setVpcLimitStoresItsOwnParameterNotTheNetworkLimit() {
27+
ProjectResponse response = new ProjectResponse();
28+
response.setNetworkLimit("5");
29+
response.setVpcLimit("10");
30+
31+
Assert.assertEquals("10", ReflectionTestUtils.getField(response, "vpcLimit"));
32+
Assert.assertEquals("5", ReflectionTestUtils.getField(response, "networkLimit"));
33+
}
34+
}

core/src/main/java/com/cloud/agent/api/storage/CreateDiskOnlyVmSnapshotAnswer.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,24 @@
2626
public class CreateDiskOnlyVmSnapshotAnswer extends Answer {
2727

2828
protected Map<String, Long> mapVolumeToSnapshotSize;
29+
private String nvramSnapshotPath;
2930

3031
public CreateDiskOnlyVmSnapshotAnswer(Command command, boolean success, String details, Map<String, Long> mapVolumeToSnapshotSize) {
32+
this(command, success, details, mapVolumeToSnapshotSize, null);
33+
}
34+
35+
public CreateDiskOnlyVmSnapshotAnswer(Command command, boolean success, String details, Map<String, Long> mapVolumeToSnapshotSize,
36+
String nvramSnapshotPath) {
3137
super(command, success, details);
3238
this.mapVolumeToSnapshotSize = mapVolumeToSnapshotSize;
39+
this.nvramSnapshotPath = nvramSnapshotPath;
3340
}
3441

3542
public Map<String, Long> getMapVolumeToSnapshotSize() {
3643
return mapVolumeToSnapshotSize;
3744
}
45+
46+
public String getNvramSnapshotPath() {
47+
return nvramSnapshotPath;
48+
}
3849
}

0 commit comments

Comments
 (0)