Skip to content

Commit aa6c581

Browse files
Add the option to filter by host when retrieving of unregistered VMs (#9925)
Co-authored-by: Nicolas Vazquez <nicovazquez90@gmail.com>
1 parent 4f604c0 commit aa6c581

27 files changed

+922
-820
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class ApiConstants {
4646
public static final String BACKUP_OFFERING_NAME = "backupofferingname";
4747
public static final String BACKUP_OFFERING_ID = "backupofferingid";
4848
public static final String BASE64_IMAGE = "base64image";
49+
public static final String BATCH_SIZE = "batchsize";
4950
public static final String BITS = "bits";
5051
public static final String BOOTABLE = "bootable";
5152
public static final String BIND_DN = "binddn";
@@ -437,11 +438,12 @@ public class ApiConstants {
437438
public static final String STATE = "state";
438439
public static final String STATS = "stats";
439440
public static final String STATUS = "status";
440-
public static final String STORAGE_TYPE = "storagetype";
441-
public static final String STORAGE_POLICY = "storagepolicy";
442-
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
443441
public static final String STORAGE_CAPABILITIES = "storagecapabilities";
444442
public static final String STORAGE_CUSTOM_STATS = "storagecustomstats";
443+
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
444+
public static final String STORAGE_POLICY = "storagepolicy";
445+
public static final String STORAGE_POOL = "storagepool";
446+
public static final String STORAGE_TYPE = "storagetype";
445447
public static final String SUBNET = "subnet";
446448
public static final String OWNER = "owner";
447449
public static final String SWAP_OWNER = "swapowner";
@@ -1106,6 +1108,7 @@ public class ApiConstants {
11061108
public static final String PARAMETER_DESCRIPTION_IS_TAG_A_RULE = "Whether the informed tag is a JS interpretable rule or not.";
11071109

11081110
public static final String NFS_MOUNT_OPTIONS = "nfsmountopts";
1111+
public static final String VMWARE_DC = "vmwaredc";
11091112

11101113
/**
11111114
* This enum specifies IO Drivers, each option controls specific policies on I/O.

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public class HostResponse extends BaseResponseWithAnnotations {
152152
@Deprecated
153153
@SerializedName("memoryallocated")
154154
@Param(description = "the amount of the host's memory currently allocated")
155-
private long memoryAllocated;
155+
private Long memoryAllocated;
156156

157157
@SerializedName("memoryallocatedpercentage")
158158
@Param(description = "the amount of the host's memory currently allocated in percentage")
@@ -395,7 +395,7 @@ public void setMemWithOverprovisioning(String memWithOverprovisioning){
395395
this.memWithOverprovisioning=memWithOverprovisioning;
396396
}
397397

398-
public void setMemoryAllocated(long memoryAllocated) {
398+
public void setMemoryAllocated(Long memoryAllocated) {
399399
this.memoryAllocated = memoryAllocated;
400400
}
401401

@@ -659,8 +659,8 @@ public Long getMemoryTotal() {
659659
return memoryTotal;
660660
}
661661

662-
public long getMemoryAllocated() {
663-
return memoryAllocated;
662+
public Long getMemoryAllocated() {
663+
return memoryAllocated == null ? 0 : memoryAllocated;
664664
}
665665

666666
public void setMemoryAllocatedPercentage(String memoryAllocatedPercentage) {

plugins/acl/dynamic-role-based/src/main/java/org/apache/cloudstack/acl/DynamicRoleBasedAPIAccessChecker.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public class DynamicRoleBasedAPIAccessChecker extends AdapterBase implements API
4747
private RoleService roleService;
4848

4949
private List<PluggableService> services;
50-
private Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<RoleType, Set<String>>();
50+
private Map<RoleType, Set<String>> annotationRoleBasedApisMap = new HashMap<>();
5151

5252
private static final Logger LOGGER = Logger.getLogger(DynamicRoleBasedAPIAccessChecker.class.getName());
5353

5454
protected DynamicRoleBasedAPIAccessChecker() {
5555
super();
5656
for (RoleType roleType : RoleType.values()) {
57-
annotationRoleBasedApisMap.put(roleType, new HashSet<String>());
57+
annotationRoleBasedApisMap.put(roleType, new HashSet<>());
5858
}
5959
}
6060

plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/VmwareDatacenterService.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
import com.cloud.dc.VsphereStoragePolicy;
2323
import com.cloud.exception.DiscoveryException;
2424
import com.cloud.exception.ResourceInUseException;
25+
import com.cloud.hypervisor.vmware.mo.HostMO;
2526
import com.cloud.storage.StoragePool;
27+
import com.cloud.utils.Pair;
2628
import com.cloud.utils.component.PluggableService;
2729
import com.cloud.utils.exception.CloudRuntimeException;
2830
import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd;
2931
import org.apache.cloudstack.api.command.admin.zone.ImportVsphereStoragePoliciesCmd;
3032
import org.apache.cloudstack.api.command.admin.zone.ListVmwareDcVmsCmd;
33+
import org.apache.cloudstack.api.command.admin.zone.ListVmwareDcHostsCmd;
3134
import org.apache.cloudstack.api.command.admin.zone.ListVmwareDcsCmd;
3235
import org.apache.cloudstack.api.command.admin.zone.ListVsphereStoragePoliciesCmd;
3336
import org.apache.cloudstack.api.command.admin.zone.ListVsphereStoragePolicyCompatiblePoolsCmd;
@@ -53,5 +56,7 @@ public interface VmwareDatacenterService extends PluggableService {
5356

5457
List<StoragePool> listVsphereStoragePolicyCompatibleStoragePools(ListVsphereStoragePolicyCompatiblePoolsCmd cmd);
5558

56-
List<UnmanagedInstanceTO> listVMsInDatacenter(ListVmwareDcVmsCmd cmd);
59+
List<HostMO> listHostsInDatacenter(ListVmwareDcHostsCmd cmd);
60+
61+
Pair<String, List<UnmanagedInstanceTO>> listVMsInDatacenter(ListVmwareDcVmsCmd cmd);
5762
}

0 commit comments

Comments
 (0)