Skip to content

Commit aadc305

Browse files
committed
Merge latest from main
2 parents 5dbf822 + ffc0d51 commit aadc305

File tree

106 files changed

+1801
-1088
lines changed

Some content is hidden

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

106 files changed

+1801
-1088
lines changed

.asf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ github:
5959
- nicoschmdt
6060
- abh1sar
6161
- sudo87
62+
- rosi-shapeblue
6263

6364
protected_branches: ~
6465

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ jobs:
237237
238238
- name: Install Python dependencies
239239
run: |
240-
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid
240+
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid pynose
241241
242242
- name: Install jacoco dependencies
243243
run: |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.cloud.storage;
1818

1919
import java.util.Date;
20+
import java.util.List;
2021

2122
import org.apache.cloudstack.api.InternalIdentity;
2223

@@ -25,6 +26,8 @@ public static enum Status {
2526
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
2627
}
2728

29+
List<Status> PENDING_DOWNLOAD_STATES = List.of(Status.NOT_DOWNLOADED, Status.DOWNLOAD_IN_PROGRESS);
30+
2831
String getInstallPath();
2932

3033
long getTemplateId();

api/src/main/java/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.cloudstack.api.command.user.iso;
1818

1919

20+
import com.cloud.dc.DataCenter;
2021
import org.apache.cloudstack.api.APICommand;
2122
import org.apache.cloudstack.api.ApiCommandResourceType;
2223
import org.apache.cloudstack.api.ApiConstants;
@@ -101,7 +102,15 @@ public long getEntityOwnerId() {
101102

102103
@Override
103104
public String getEventDescription() {
104-
return "extracting ISO: " + getId() + " from zone: " + getZoneId();
105+
String isoId = this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId());
106+
String baseDescription = String.format("Extracting ISO: %s", isoId);
107+
108+
Long zoneId = getZoneId();
109+
if (zoneId == null) {
110+
return baseDescription;
111+
}
112+
113+
return String.format("%s from zone: %s", baseDescription, this._uuidMgr.getUuid(DataCenter.class, zoneId));
105114
}
106115

107116
@Override

api/src/main/java/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ public String getEventType() {
101101

102102
@Override
103103
public String getEventDescription() {
104-
return "extracting template: " + this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId()) + ((getZoneId() != null) ? " from zone: " + this._uuidMgr.getUuid(DataCenter.class, getZoneId()) : "");
104+
String templateId = this._uuidMgr.getUuid(VirtualMachineTemplate.class, getId());
105+
String baseDescription = String.format("Extracting template: %s", templateId);
106+
107+
Long zoneId = getZoneId();
108+
if (zoneId == null) {
109+
return baseDescription;
110+
}
111+
112+
return String.format("%s from zone: %s", baseDescription, this._uuidMgr.getUuid(DataCenter.class, zoneId));
105113
}
106114

107115
@Override

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.cloudstack.api.command.user.volume;
1818

1919

20+
import com.cloud.dc.DataCenter;
2021
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
2122
import org.apache.cloudstack.api.ACL;
2223
import org.apache.cloudstack.api.APICommand;
@@ -114,12 +115,15 @@ public String getEventType() {
114115

115116
@Override
116117
public String getEventDescription() {
117-
return "Extraction job";
118+
String volumeId = this._uuidMgr.getUuid(Volume.class, getId());
119+
String zoneId = this._uuidMgr.getUuid(DataCenter.class, getZoneId());
120+
121+
return String.format("Extracting volume: %s from zone: %s", volumeId, zoneId);
118122
}
119123

120124
@Override
121125
public void execute() {
122-
CallContext.current().setEventDetails("Volume Id: " + this._uuidMgr.getUuid(Volume.class, getId()));
126+
CallContext.current().setEventDetails(getEventDescription());
123127
String uploadUrl = _volumeService.extractVolume(this);
124128
if (uploadUrl != null) {
125129
ExtractResponse response = _responseGenerator.createVolumeExtractResponse(id, zoneId, getEntityOwnerId(), mode, uploadUrl);

api/src/test/java/org/apache/cloudstack/api/command/admin/resource/PurgeExpungedResourcesCmdTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class PurgeExpungedResourcesCmdTest {
4444

4545
@Spy
4646
@InjectMocks
47-
PurgeExpungedResourcesCmd spyCmd = Mockito.spy(new PurgeExpungedResourcesCmd());
47+
PurgeExpungedResourcesCmd spyCmd;
4848

4949
@Test
5050
public void testGetResourceType() {

api/src/test/java/org/apache/cloudstack/api/command/admin/storage/DownloadImageStoreObjectCmdTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@
2020
import com.cloud.utils.Pair;
2121
import org.apache.cloudstack.api.response.ExtractResponse;
2222
import org.apache.cloudstack.storage.browser.StorageBrowser;
23-
import org.junit.After;
2423
import org.junit.Assert;
25-
import org.junit.Before;
2624
import org.junit.Test;
2725
import org.junit.runner.RunWith;
2826
import org.mockito.InjectMocks;
2927
import org.mockito.Mock;
30-
import org.mockito.MockitoAnnotations;
3128
import org.mockito.Spy;
3229
import org.mockito.junit.MockitoJUnitRunner;
3330
import org.springframework.test.util.ReflectionTestUtils;
@@ -48,18 +45,6 @@ public class DownloadImageStoreObjectCmdTest {
4845
@Spy
4946
private DownloadImageStoreObjectCmd cmd;
5047

51-
private AutoCloseable closeable;
52-
53-
@Before
54-
public void setUp() {
55-
closeable = MockitoAnnotations.openMocks(this);
56-
}
57-
58-
@After
59-
public void tearDown() throws Exception {
60-
closeable.close();
61-
}
62-
6348
@Test
6449
public void testExecute() throws Exception {
6550
ReflectionTestUtils.setField(cmd, "storeId", 1L);

api/src/test/java/org/apache/cloudstack/api/command/admin/vm/MigrateVirtualMachineWithVolumeCmdTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ public class MigrateVirtualMachineWithVolumeCmdTest {
6868
@Mock
6969
Host hostMock;
7070

71+
@Mock
72+
private Object job;
73+
74+
@Mock
75+
private Object _responseObject;
76+
7177
@Spy
7278
@InjectMocks
7379
MigrateVirtualMachineWithVolumeCmd cmdSpy;

api/src/test/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCCmdByAdminTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.cloud.network.vpc.VpcService;
2121
import com.cloud.user.AccountService;
2222
import com.cloud.utils.db.EntityManager;
23-
import junit.framework.TestCase;
2423
import org.apache.cloudstack.api.ResponseGenerator;
2524
import org.junit.Assert;
2625
import org.junit.Test;
@@ -34,7 +33,7 @@
3433
import java.util.List;
3534

3635
@RunWith(MockitoJUnitRunner.class)
37-
public class CreateVPCCmdByAdminTest extends TestCase {
36+
public class CreateVPCCmdByAdminTest {
3837

3938
@Mock
4039
public VpcService _vpcService;
@@ -43,8 +42,10 @@ public class CreateVPCCmdByAdminTest extends TestCase {
4342
@Mock
4443
public AccountService _accountService;
4544
private ResponseGenerator responseGenerator;
45+
@Mock
46+
public Object job;
4647
@InjectMocks
47-
CreateVPCCmdByAdmin cmd = new CreateVPCCmdByAdmin();
48+
CreateVPCCmdByAdmin cmd;
4849

4950
@Test
5051
public void testBgpPeerIds() {

0 commit comments

Comments
 (0)