Skip to content

Commit 9694fa6

Browse files
authored
Merge branch '4.22' into UserVmManagerCleanup
2 parents 2ec18d0 + 71bd26f commit 9694fa6

File tree

83 files changed

+1225
-588
lines changed

Some content is hidden

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

83 files changed

+1225
-588
lines changed

.github/workflows/merge-conflict-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
name: "PR Merge Conflict Check"
1919
on:
2020
push:
21-
pull_request_target:
22-
types: [synchronize]
21+
pull_request:
22+
types: [opened, synchronize, reopened]
2323

2424
permissions: # added using https://github.com/step-security/secure-workflows
2525
contents: read

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException
523523
* @param userId user ID
524524
* @param serviceOffering service offering for the imported VM
525525
* @param sshPublicKey ssh key for the imported VM
526+
* @param guestOsId guest OS ID for the imported VM (if not passed, then the guest OS of the template will be used)
526527
* @param hostName the name for the imported VM
527528
* @param hypervisorType hypervisor type for the imported VM
528529
* @param customParameters details for the imported VM
@@ -532,7 +533,7 @@ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException
532533
* @throws InsufficientCapacityException in case of errors
533534
*/
534535
UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceNameInternal, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
535-
final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey,
536+
final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey, final Long guestOsId,
536537
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters,
537538
final VirtualMachine.PowerState powerState, final LinkedHashMap<String, List<NicProfile>> networkNicMap) throws InsufficientCapacityException;
538539

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public static StateMachine2<State, VirtualMachine.Event, VirtualMachine> getStat
124124
s_fsm.addTransition(new Transition<State, Event>(State.Stopping, VirtualMachine.Event.StopRequested, State.Stopping, null));
125125
s_fsm.addTransition(new Transition<State, Event>(State.Stopping, VirtualMachine.Event.AgentReportShutdowned, State.Stopped, Arrays.asList(new Impact[]{Impact.USAGE})));
126126
s_fsm.addTransition(new Transition<State, Event>(State.Expunging, VirtualMachine.Event.OperationFailed, State.Expunging,null));
127+
// Note: In addition to the Stopped -> Error transition for failed VM creation,
128+
// a VM can also transition from Expunging to Error on OperationFailedToError.
129+
s_fsm.addTransition(new Transition<State, Event>(State.Expunging, VirtualMachine.Event.OperationFailedToError, State.Error, null));
127130
s_fsm.addTransition(new Transition<State, Event>(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging,null));
128131
s_fsm.addTransition(new Transition<State, Event>(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging, null));
129132
s_fsm.addTransition(new Transition<State, Event>(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging, null));

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
4949

5050
boolean resetPassword(UserAccount userAccount, String token, String password);
5151

52+
String getDomainId(Map<String, Object[]> params);
53+
5254
boolean isPostRequestsAndTimestampsEnforced();
5355
}

api/src/main/java/org/apache/cloudstack/api/command/admin/vm/ImportVmCmd.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.cloudstack.api.Parameter;
3131
import org.apache.cloudstack.api.ResponseObject;
3232
import org.apache.cloudstack.api.ServerApiException;
33+
import org.apache.cloudstack.api.response.GuestOSResponse;
3334
import org.apache.cloudstack.api.response.HostResponse;
3435
import org.apache.cloudstack.api.response.NetworkResponse;
3536
import org.apache.cloudstack.api.response.StoragePoolResponse;
@@ -171,6 +172,13 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
171172
description = "(only for importing VMs from VMware to KVM) optional - if true, forces virt-v2v conversions to write directly on the provided storage pool (avoid using temporary conversion pool).")
172173
private Boolean forceConvertToPool;
173174

175+
@Parameter(name = ApiConstants.OS_ID,
176+
type = CommandType.UUID,
177+
entityType = GuestOSResponse.class,
178+
since = "4.22.1",
179+
description = "(only for importing VMs from VMware to KVM) optional - the ID of the guest OS for the imported VM.")
180+
private Long guestOsId;
181+
174182
/////////////////////////////////////////////////////
175183
/////////////////// Accessors ///////////////////////
176184
/////////////////////////////////////////////////////
@@ -268,6 +276,10 @@ public boolean getForceConvertToPool() {
268276
return BooleanUtils.toBooleanDefaultIfNull(forceConvertToPool, false);
269277
}
270278

279+
public Long getGuestOsId() {
280+
return guestOsId;
281+
}
282+
271283
@Override
272284
public String getEventDescription() {
273285
String vmName = getName();

api/src/main/java/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public class ListGuestOsCmd extends BaseListCmd {
4545
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = GuestOSResponse.class, description = "List by OS type ID")
4646
private Long id;
4747

48+
@Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID,
49+
entityType = GuestOSResponse.class, since = "4.22.1",
50+
description = "Comma separated list of OS types")
51+
private List<Long> ids;
52+
4853
@Parameter(name = ApiConstants.OS_CATEGORY_ID, type = CommandType.UUID, entityType = GuestOSCategoryResponse.class, description = "List by OS Category ID")
4954
private Long osCategoryId;
5055

@@ -63,6 +68,10 @@ public Long getId() {
6368
return id;
6469
}
6570

71+
public List<Long> getIds() {
72+
return ids;
73+
}
74+
6675
public Long getOsCategoryId() {
6776
return osCategoryId;
6877
}

api/src/main/java/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd {
4646
@Parameter(name = ApiConstants.GATEWAY_ID,
4747
type = CommandType.UUID,
4848
entityType = PrivateGatewayResponse.class,
49-
required = true,
5049
description = "The gateway ID we are creating static route for. Mutually exclusive with the nexthop parameter")
5150
private Long gatewayId;
5251

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ public class UnmanagedInstanceResponse extends BaseResponse {
5151
@Param(description = "The name of the host to which Instance belongs")
5252
private String hostName;
5353

54+
@SerializedName(ApiConstants.HYPERVISOR)
55+
@Param(description = "The hypervisor to which Instance belongs")
56+
private String hypervisor;
57+
58+
@SerializedName(ApiConstants.HYPERVISOR_VERSION)
59+
@Param(description = "The hypervisor version of the host to which Instance belongs")
60+
private String hypervisorVersion;
61+
5462
@SerializedName(ApiConstants.POWER_STATE)
5563
@Param(description = "The power state of the Instance")
5664
private String powerState;
@@ -140,6 +148,22 @@ public void setHostName(String hostName) {
140148
this.hostName = hostName;
141149
}
142150

151+
public String getHypervisor() {
152+
return hypervisor;
153+
}
154+
155+
public void setHypervisor(String hypervisor) {
156+
this.hypervisor = hypervisor;
157+
}
158+
159+
public String getHypervisorVersion() {
160+
return hypervisorVersion;
161+
}
162+
163+
public void setHypervisorVersion(String hypervisorVersion) {
164+
this.hypervisorVersion = hypervisorVersion;
165+
}
166+
143167
public String getPowerState() {
144168
return powerState;
145169
}

api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,29 @@
2525
import org.apache.cloudstack.api.response.ListResponse;
2626
import org.apache.cloudstack.api.response.VolumeForImportResponse;
2727
import org.apache.cloudstack.api.response.VolumeResponse;
28+
import org.apache.cloudstack.framework.config.ConfigKey;
29+
import org.apache.cloudstack.framework.config.Configurable;
2830

2931
import java.util.Arrays;
3032
import java.util.List;
3133

32-
public interface VolumeImportUnmanageService extends PluggableService {
34+
public interface VolumeImportUnmanageService extends PluggableService, Configurable {
3335

3436
List<Hypervisor.HypervisorType> SUPPORTED_HYPERVISORS =
3537
Arrays.asList(Hypervisor.HypervisorType.KVM, Hypervisor.HypervisorType.VMware);
3638

3739
List<Storage.StoragePoolType> SUPPORTED_STORAGE_POOL_TYPES_FOR_KVM = Arrays.asList(Storage.StoragePoolType.NetworkFilesystem,
3840
Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD);
3941

42+
ConfigKey<Boolean> AllowImportVolumeWithBackingFile = new ConfigKey<>(Boolean.class,
43+
"allow.import.volume.with.backing.file",
44+
"Advanced",
45+
"false",
46+
"If enabled, allows QCOW2 volumes with backing files to be imported or unmanaged",
47+
true,
48+
ConfigKey.Scope.Global,
49+
null);
50+
4051
ListResponse<VolumeForImportResponse> listVolumesForImport(ListVolumesForImportCmd cmd);
4152

4253
VolumeResponse importVolume(ImportVolumeCmd cmd);

api/src/main/java/org/apache/cloudstack/vm/UnmanagedInstanceTO.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public enum PowerState {
5555

5656
private String hostName;
5757

58+
private String hypervisorType;
59+
private String hostHypervisorVersion;
60+
5861
private List<Disk> disks;
5962

6063
private List<Nic> nics;
@@ -168,6 +171,22 @@ public void setHostName(String hostName) {
168171
this.hostName = hostName;
169172
}
170173

174+
public String getHypervisorType() {
175+
return hypervisorType;
176+
}
177+
178+
public void setHypervisorType(String hypervisorType) {
179+
this.hypervisorType = hypervisorType;
180+
}
181+
182+
public String getHostHypervisorVersion() {
183+
return hostHypervisorVersion;
184+
}
185+
186+
public void setHostHypervisorVersion(String hostHypervisorVersion) {
187+
this.hostHypervisorVersion = hostHypervisorVersion;
188+
}
189+
171190
public List<Disk> getDisks() {
172191
return disks;
173192
}

0 commit comments

Comments
 (0)