Skip to content

Commit 0540374

Browse files
committed
post merge fixes
1 parent f9102dc commit 0540374

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public class CreateVMFromBackupCmdByAdmin extends CreateVMFromBackupCmd implemen
4545
@Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.UUID, entityType = ClusterResponse.class, description = "destination Cluster ID to deploy the VM to - parameter available for root admin only", since = "4.21")
4646
private Long clusterId;
4747

48+
private String instanceType;
49+
4850
public Long getPodId() {
4951
return podId;
5052
}
@@ -53,10 +55,16 @@ public Long getClusterId() {
5355
return clusterId;
5456
}
5557

58+
@Override
59+
public String getInstanceType() {
60+
return instanceType;
61+
}
62+
5663
public CreateVMFromBackupCmdByAdmin(){}
5764

58-
public CreateVMFromBackupCmdByAdmin(String hypervisor) {
65+
public CreateVMFromBackupCmdByAdmin(String hypervisor, String instanceType) {
5966
this.displayVm = false;
6067
this.hypervisor = hypervisor;
68+
this.instanceType = instanceType;
6169
}
6270
}

plugins/integrations/veeam-control-service/src/main/java/org/apache/cloudstack/veeam/adapter/ServerAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ public DiskAttachment attachInstanceDisk(final String vmUuid, final DiskAttachme
16101610
context.setEventDetails("Volume Id: " + volumeVO.getUuid() + " VmId: " + vmVo.getUuid());
16111611
context.setEventResourceType(ApiCommandResourceType.Volume);
16121612
context.setEventResourceId(volumeVO.getId());
1613-
Volume volume = volumeApiService.attachVolumeToVM(vmVo.getId(), volumeVO.getId(), deviceId, true);
1613+
Volume volume = volumeApiService.attachVolumeToVM(vmVo.getId(), volumeVO.getId(), deviceId, true, false);
16141614
processInstanceRestoreConfigIfNeeded(vmVo, volume);
16151615
VolumeJoinVO attachedVolumeVO = volumeJoinDao.findById(volume.getId());
16161616
return VolumeJoinVOToDiskConverter.toDiskAttachment(attachedVolumeVO, this::getVolumePhysicalSize);
@@ -1696,7 +1696,7 @@ public void deleteDisk(String uuid) {
16961696
context.setEventDetails("Volume Id: " + vo.getUuid());
16971697
context.setEventResourceType(ApiCommandResourceType.Volume);
16981698
context.setEventResourceId(vo.getId());
1699-
volumeApiService.destroyVolume(vo.getId(), CallContext.current().getCallingAccount(), true, false);
1699+
volumeApiService.destroyVolume(vo.getId(), CallContext.current().getCallingAccount(), true, false, null);
17001700
}
17011701

17021702
@ApiAccess(command = UpdateVolumeCmd.class)

plugins/integrations/veeam-control-service/src/test/java/org/apache/cloudstack/veeam/adapter/ServerAdapterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ public void testDeleteDisk_Found_DeletesVolume() {
970970

971971
serverAdapter.deleteDisk("vol-uuid");
972972

973-
verify(volumeApiService).destroyVolume(10L, account, true, false);
973+
verify(volumeApiService).destroyVolume(10L, account, true, false, null);
974974
}
975975

976976

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6642,12 +6642,12 @@ public UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityE
66426642
}
66436643

66446644
return createVirtualMachine(cmd, zone, owner, serviceOffering, template, cmd.getHypervisor(), diskOfferingId, cmd.getSize(), overrideDiskOfferingId, dataDiskInfoList,
6645-
networkIds, cmd.getIpToNetworkMap(), volume, snapshot, null);
6645+
networkIds, cmd.getIpToNetworkMap(), volume, snapshot);
66466646
}
66476647

66486648
private UserVm createVirtualMachine(BaseDeployVMCmd cmd, DataCenter zone, Account owner, ServiceOffering serviceOffering, VirtualMachineTemplate template,
66496649
HypervisorType hypervisor, Long diskOfferingId, Long size, Long overrideDiskOfferingId, List<VmDiskInfo> dataDiskInfoList,
6650-
List<Long> networkIds, Map<Long, IpAddresses> ipToNetworkMap, Volume volume, Snapshot snapshot, String userVmType) throws InsufficientCapacityException,
6650+
List<Long> networkIds, Map<Long, IpAddresses> ipToNetworkMap, Volume volume, Snapshot snapshot) throws InsufficientCapacityException,
66516651
ResourceUnavailableException, ConcurrentOperationException, ResourceAllocationException {
66526652

66536653
ServiceOfferingJoinVO svcOffering = serviceOfferingJoinDao.findById(serviceOffering.getId());
@@ -9973,7 +9973,7 @@ public UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws Insufficien
99739973
}
99749974

99759975
UserVm vm = createVirtualMachine(cmd, targetZone, owner, serviceOffering, template, hypervisorType, diskOfferingId, size, overrideDiskOfferingId, dataDiskInfoList,
9976-
networkIds, ipToNetworkMap, null, null, null);
9976+
networkIds, ipToNetworkMap, null, null);
99779977

99789978
String vmSettingsFromBackup = backup.getDetail(ApiConstants.VM_SETTINGS);
99799979
if (vm != null && vmSettingsFromBackup != null) {
@@ -10280,9 +10280,8 @@ public UserVm allocateVMForValidation(long backupId, HypervisorType hypervisor)
1028010280
networkIds.add(network.getId());
1028110281

1028210282
Account owner = _accountService.getActiveAccountById(backup.getAccountId());
10283-
CreateVMFromBackupCmd cmd = new CreateVMFromBackupCmdByAdmin(hypervisor.name());
10284-
UserVm vm = createVirtualMachine(cmd, zone, owner, serviceOffering, template, hypervisorType, null, size, null, dataDiskInfoList, networkIds, null, null, null,
10285-
VALIDATION_VM);
10283+
CreateVMFromBackupCmd cmd = new CreateVMFromBackupCmdByAdmin(hypervisor.name(), VALIDATION_VM);
10284+
UserVm vm = createVirtualMachine(cmd, zone, owner, serviceOffering, template, hypervisorType, null, size, null, dataDiskInfoList, networkIds, null, null, null);
1028610285

1028710286
String vmSettingsFromBackup = backup.getDetail(ApiConstants.VM_SETTINGS);
1028810287
UserVmVO vmVO = null;

0 commit comments

Comments
 (0)