Skip to content

Commit 42bbf17

Browse files
author
SadiJr
committed
Merge branch 'main' into veeam-check-failure-when-restoring
2 parents 0f7d273 + 1925040 commit 42bbf17

File tree

137 files changed

+5566
-787
lines changed

Some content is hidden

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

137 files changed

+5566
-787
lines changed

.asf.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ github:
5656
- alexandremattioli
5757
- vishesh92
5858
- GaOrtiga
59-
- BryanMLima
6059
- SadiJr
61-
- JoaoJandre
6260
- winterhazel
61+
- rp-
6362

6463
protected_branches: ~
6564

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Apache CloudStack [![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) [![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack)
22

3-
[![Apache CloudStack](tools/logo/apache_cloudstack.png)](https://cloudstack.apache.org/)
3+
[![Apache CloudStack](tools/logo/acsxmas.jpg)](https://cloudstack.apache.org/)
44

55
Apache CloudStack is open source software designed to deploy and manage large
66
networks of virtual machines, as a highly available, highly scalable

api/src/main/java/com/cloud/network/PublicIpQuarantine.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public interface PublicIpQuarantine extends InternalIdentity, Identity {
3030

3131
String getRemovalReason();
3232

33+
Long getRemoverAccountId();
34+
3335
Date getRemoved();
3436

3537
Date getCreated();

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

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,49 @@ enum Type {
3939
};
4040

4141
enum State {
42-
Allocated("The volume is allocated but has not been created yet."),
43-
Creating("The volume is being created. getPoolId() should reflect the pool where it is being created."),
44-
Ready("The volume is ready to be used."),
45-
Migrating("The volume is migrating to other storage pool"),
46-
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
47-
RevertSnapshotting("There is a snapshot created on this volume, the volume is being reverting from snapshot"),
48-
Resizing("The volume is being resized"),
49-
Expunging("The volume is being expunging"),
50-
Expunged("The volume has been expunged, and can no longer be recovered"),
51-
Destroy("The volume is destroyed, and can be recovered."),
52-
Destroying("The volume is destroying, and can't be recovered."),
53-
UploadOp("The volume upload operation is in progress or in short the volume is on secondary storage"),
54-
Copying("Volume is copying from image store to primary, in case it's an uploaded volume"),
55-
Uploaded("Volume is uploaded"),
56-
NotUploaded("The volume entry is just created in DB, not yet uploaded"),
57-
UploadInProgress("Volume upload is in progress"),
58-
UploadError("Volume upload encountered some error"),
59-
UploadAbandoned("Volume upload is abandoned since the upload was never initiated within a specified time"),
60-
Attaching("The volume is attaching to a VM from Ready state."),
61-
Restoring("The volume is being restored from backup.");
42+
Allocated(false, "The volume is allocated but has not been created yet."),
43+
Creating(true, "The volume is being created. getPoolId() should reflect the pool where it is being created."),
44+
Ready(false, "The volume is ready to be used."),
45+
Migrating(true, "The volume is migrating to other storage pool"),
46+
Snapshotting(true, "There is a snapshot created on this volume, not backed up to secondary storage yet"),
47+
RevertSnapshotting(true, "There is a snapshot created on this volume, the volume is being reverting from snapshot"),
48+
Resizing(true, "The volume is being resized"),
49+
Expunging(true, "The volume is being expunging"),
50+
Expunged(false, "The volume has been expunged, and can no longer be recovered"),
51+
Destroy(false, "The volume is destroyed, and can be recovered."),
52+
Destroying(false, "The volume is destroying, and can't be recovered."),
53+
UploadOp(true, "The volume upload operation is in progress or in short the volume is on secondary storage"),
54+
Copying(true, "Volume is copying from image store to primary, in case it's an uploaded volume"),
55+
Uploaded(false, "Volume is uploaded"),
56+
NotUploaded(true, "The volume entry is just created in DB, not yet uploaded"),
57+
UploadInProgress(true, "Volume upload is in progress"),
58+
UploadError(false, "Volume upload encountered some error"),
59+
UploadAbandoned(false, "Volume upload is abandoned since the upload was never initiated within a specified time"),
60+
Attaching(true, "The volume is attaching to a VM from Ready state."),
61+
Restoring(true, "The volume is being restored from backup.");
62+
63+
boolean _transitional;
6264

6365
String _description;
6466

65-
private State(String description) {
67+
/**
68+
* Volume State
69+
* @param transitional true for transition/non-final state, otherwise false
70+
* @param description description of the state
71+
*/
72+
private State(boolean transitional, String description) {
73+
_transitional = transitional;
6674
_description = description;
6775
}
6876

6977
public static StateMachine2<State, Event, Volume> getStateMachine() {
7078
return s_fsm;
7179
}
7280

81+
public boolean isTransitional() {
82+
return _transitional;
83+
}
84+
7385
public String getDescription() {
7486
return _description;
7587
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
package com.cloud.vm;
1818

19+
import java.util.LinkedHashMap;
1920
import java.util.List;
2021
import java.util.Map;
2122

@@ -518,7 +519,8 @@ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException
518519

519520
UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceName, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
520521
final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey,
521-
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters, final VirtualMachine.PowerState powerState) throws InsufficientCapacityException;
522+
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters,
523+
final VirtualMachine.PowerState powerState, final LinkedHashMap<String, List<NicProfile>> networkNicMap) throws InsufficientCapacityException;
522524

523525
/**
524526
* Unmanage a guest VM from CloudStack

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public interface VmDetailConstants {
3939
// KVM specific (internal)
4040
String KVM_VNC_PORT = "kvm.vnc.port";
4141
String KVM_VNC_ADDRESS = "kvm.vnc.address";
42+
String KVM_VNC_PASSWORD = "kvm.vnc.password";
4243

4344
// KVM specific, custom virtual GPU hardware
4445
String VIDEO_HARDWARE = "video.hardware";

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public class ApiConstants {
212212
public static final String HOST_IDS = "hostids";
213213
public static final String HOST_IP = "hostip";
214214
public static final String HOST_NAME = "hostname";
215+
public static final String HOST = "host";
215216
public static final String HOST_CONTROL_STATE = "hostcontrolstate";
216217
public static final String HOSTS_MAP = "hostsmap";
217218
public static final String HYPERVISOR = "hypervisor";
@@ -802,6 +803,7 @@ public class ApiConstants {
802803
public static final String IPSEC_PSK = "ipsecpsk";
803804
public static final String GUEST_IP = "guestip";
804805
public static final String REMOVED = "removed";
806+
public static final String REMOVER_ACCOUNT_ID = "removeraccountid";
805807
public static final String REMOVAL_REASON = "removalreason";
806808
public static final String COMPLETED = "completed";
807809
public static final String IKE_VERSION = "ikeversion";
@@ -1064,7 +1066,9 @@ public class ApiConstants {
10641066
public static final String SOURCE_NAT_IP = "sourcenatipaddress";
10651067
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
10661068
public static final String HAS_RULES = "hasrules";
1069+
public static final String DISK_PATH = "diskpath";
10671070
public static final String IMPORT_SOURCE = "importsource";
1071+
public static final String TEMP_PATH = "temppath";
10681072
public static final String OBJECT_STORAGE = "objectstore";
10691073

10701074
public static final String HEURISTIC_RULE = "heuristicrule";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
8484
@Parameter(name = ApiConstants.NAME,
8585
type = CommandType.STRING,
8686
required = true,
87-
description = "the hypervisor name of the instance")
87+
description = "the name of the instance as it is known to the hypervisor")
8888
private String name;
8989

9090
@Parameter(name = ApiConstants.DISPLAY_NAME,

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

Lines changed: 106 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,18 @@
3131
import org.apache.cloudstack.api.ResponseObject;
3232
import org.apache.cloudstack.api.ServerApiException;
3333
import org.apache.cloudstack.api.response.HostResponse;
34+
import org.apache.cloudstack.api.response.NetworkResponse;
3435
import org.apache.cloudstack.api.response.StoragePoolResponse;
3536
import org.apache.cloudstack.api.response.UserVmResponse;
3637
import org.apache.cloudstack.api.response.VmwareDatacenterResponse;
38+
import org.apache.cloudstack.api.response.ZoneResponse;
39+
import org.apache.cloudstack.vm.VmImportService;
3740
import org.apache.commons.lang3.ObjectUtils;
3841
import org.apache.commons.lang3.StringUtils;
3942
import org.apache.log4j.Logger;
4043

44+
import javax.inject.Inject;
45+
4146
@APICommand(name = "importVm",
4247
description = "Import virtual machine from a unmanaged host into CloudStack",
4348
responseObject = UserVmResponse.class,
@@ -47,21 +52,72 @@
4752
authorized = {RoleType.Admin},
4853
since = "4.19.0")
4954
public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
50-
5155
public static final Logger LOGGER = Logger.getLogger(ImportVmCmd.class);
5256

57+
@Inject
58+
public VmImportService vmImportService;
59+
60+
/////////////////////////////////////////////////////
61+
//////////////// API parameters /////////////////////
62+
/////////////////////////////////////////////////////
63+
64+
65+
@Parameter(name = ApiConstants.ZONE_ID,
66+
type = CommandType.UUID,
67+
entityType = ZoneResponse.class,
68+
required = true,
69+
description = "the zone ID")
70+
private Long zoneId;
71+
72+
@Parameter(name = ApiConstants.USERNAME,
73+
type = CommandType.STRING,
74+
description = "the username for the host")
75+
private String username;
76+
77+
@Parameter(name = ApiConstants.PASSWORD,
78+
type = CommandType.STRING,
79+
description = "the password for the host")
80+
private String password;
81+
82+
@Parameter(name = ApiConstants.HOST,
83+
type = CommandType.STRING,
84+
description = "the host name or IP address")
85+
private String host;
86+
5387
@Parameter(name = ApiConstants.HYPERVISOR,
5488
type = CommandType.STRING,
5589
required = true,
5690
description = "hypervisor type of the host")
5791
private String hypervisor;
5892

93+
@Parameter(name = ApiConstants.DISK_PATH,
94+
type = CommandType.STRING,
95+
description = "path of the disk image")
96+
private String diskPath;
97+
5998
@Parameter(name = ApiConstants.IMPORT_SOURCE,
6099
type = CommandType.STRING,
61100
required = true,
62101
description = "Source location for Import" )
63102
private String importSource;
64103

104+
@Parameter(name = ApiConstants.NETWORK_ID,
105+
type = CommandType.UUID,
106+
entityType = NetworkResponse.class,
107+
description = "the network ID")
108+
private Long networkId;
109+
110+
@Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "Host where local disk is located")
111+
private Long hostId;
112+
113+
@Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "Shared storage pool where disk is located")
114+
private Long storagePoolId;
115+
116+
@Parameter(name = ApiConstants.TEMP_PATH,
117+
type = CommandType.STRING,
118+
description = "Temp Path on external host for disk image copy" )
119+
private String tmpPath;
120+
65121
// Import from Vmware to KVM migration parameters
66122

67123
@Parameter(name = ApiConstants.EXISTING_VCENTER_ID,
@@ -73,7 +129,7 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
73129
@Parameter(name = ApiConstants.HOST_IP,
74130
type = BaseCmd.CommandType.STRING,
75131
description = "(only for importing migrated VMs from Vmware to KVM) VMware ESXi host IP/Name.")
76-
private String host;
132+
private String hostip;
77133

78134
@Parameter(name = ApiConstants.VCENTER,
79135
type = CommandType.STRING,
@@ -88,14 +144,6 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
88144
description = "(only for importing migrated VMs from Vmware to KVM) Name of VMware cluster.")
89145
private String clusterName;
90146

91-
@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING,
92-
description = "(only for importing migrated VMs from Vmware to KVM) The Username required to connect to resource.")
93-
private String username;
94-
95-
@Parameter(name = ApiConstants.PASSWORD, type = CommandType.STRING,
96-
description = "(only for importing migrated VMs from Vmware to KVM) The password for the specified username.")
97-
private String password;
98-
99147
@Parameter(name = ApiConstants.CONVERT_INSTANCE_HOST_ID, type = CommandType.UUID, entityType = HostResponse.class,
100148
description = "(only for importing migrated VMs from Vmware to KVM) optional - the host to perform the virt-v2v migration from VMware to KVM.")
101149
private Long convertInstanceHostId;
@@ -104,30 +152,20 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
104152
description = "(only for importing migrated VMs from Vmware to KVM) optional - the temporary storage pool to perform the virt-v2v migration from VMware to KVM.")
105153
private Long convertStoragePoolId;
106154

107-
@Override
108-
public String getEventType() {
109-
return EventTypes.EVENT_VM_IMPORT;
110-
}
155+
/////////////////////////////////////////////////////
156+
/////////////////// Accessors ///////////////////////
157+
/////////////////////////////////////////////////////
111158

112-
@Override
113-
public String getEventDescription() {
114-
String vmName = getName();
115-
if (ObjectUtils.anyNotNull(vcenter, existingVcenterId)) {
116-
String msg = StringUtils.isNotBlank(vcenter) ?
117-
String.format("external vCenter: %s - datacenter: %s", vcenter, datacenterName) :
118-
String.format("existing vCenter Datacenter with ID: %s", existingVcenterId);
119-
return String.format("Importing unmanaged VM: %s from %s - VM: %s", getDisplayName(), msg, vmName);
120-
}
121-
return String.format("Importing unmanaged VM: %s", vmName);
159+
public Long getZoneId() {
160+
return zoneId;
122161
}
123162

124-
125163
public Long getExistingVcenterId() {
126164
return existingVcenterId;
127165
}
128166

129-
public String getHost() {
130-
return host;
167+
public String getHostIp() {
168+
return hostip;
131169
}
132170

133171
public String getVcenter() {
@@ -150,6 +188,10 @@ public String getPassword() {
150188
return password;
151189
}
152190

191+
public String getHost() {
192+
return host;
193+
}
194+
153195
public Long getConvertInstanceHostId() {
154196
return convertInstanceHostId;
155197
}
@@ -162,10 +204,47 @@ public String getHypervisor() {
162204
return hypervisor;
163205
}
164206

207+
public String getDiskPath() {
208+
return diskPath;
209+
}
210+
165211
public String getImportSource() {
166212
return importSource;
167213
}
168214

215+
public Long getHostId() {
216+
return hostId;
217+
}
218+
219+
public Long getStoragePoolId() {
220+
return storagePoolId;
221+
}
222+
223+
public String getTmpPath() {
224+
return tmpPath;
225+
}
226+
227+
public Long getNetworkId() {
228+
return networkId;
229+
}
230+
231+
@Override
232+
public String getEventType() {
233+
return EventTypes.EVENT_VM_IMPORT;
234+
}
235+
236+
@Override
237+
public String getEventDescription() {
238+
String vmName = getName();
239+
if (ObjectUtils.anyNotNull(vcenter, existingVcenterId)) {
240+
String msg = StringUtils.isNotBlank(vcenter) ?
241+
String.format("external vCenter: %s - datacenter: %s", vcenter, datacenterName) :
242+
String.format("existing vCenter Datacenter with ID: %s", existingVcenterId);
243+
return String.format("Importing unmanaged VM: %s from %s - VM: %s", getDisplayName(), msg, vmName);
244+
}
245+
return String.format("Importing unmanaged VM: %s", vmName);
246+
}
247+
169248
/////////////////////////////////////////////////////
170249
/////////////// API Implementation///////////////////
171250
/////////////////////////////////////////////////////
@@ -176,5 +255,4 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
176255
response.setResponseName(getCommandName());
177256
setResponseObject(response);
178257
}
179-
180258
}

0 commit comments

Comments
 (0)