[
https://issues.apache.org/jira/browse/CLOUDSTACK-8609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15156140#comment-15156140
]
ASF GitHub Bot commented on CLOUDSTACK-8609:
--------------------------------------------
Github user GabrielBrascher commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/556#discussion_r53570662
--- Diff:
vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java ---
@@ -880,6 +880,38 @@ else if (prop.getName().startsWith("value[")) {
return networks;
}
+ public List<DatastoreMO> getAllDatastores() throws Exception {
+ PropertySpec pSpec = new PropertySpec();
+ pSpec.setType("Datastore");
+ pSpec.getPathSet().add("name");
+
+ TraversalSpec vmDatastoreTraversal = new TraversalSpec();
+ vmDatastoreTraversal.setType("VirtualMachine");
+ vmDatastoreTraversal.setPath("datastore");
+ vmDatastoreTraversal.setName("vmDatastoreTraversal");
+
+ ObjectSpec oSpec = new ObjectSpec();
+ oSpec.setObj(_mor);
+ oSpec.setSkip(Boolean.TRUE);
+ oSpec.getSelectSet().add(vmDatastoreTraversal);
+
+ PropertyFilterSpec pfSpec = new PropertyFilterSpec();
+ pfSpec.getPropSet().add(pSpec);
+ pfSpec.getObjectSet().add(oSpec);
+ List<PropertyFilterSpec> pfSpecArr = new
ArrayList<PropertyFilterSpec>();
+ pfSpecArr.add(pfSpec);
+
+ List<ObjectContent> ocs =
_context.getService().retrieveProperties(_context.getPropertyCollector(),
pfSpecArr);
+
+ List<DatastoreMO> datastores = new ArrayList<DatastoreMO>();
+ if (ocs != null && ocs.size() > 0) {
--- End diff --
Hi @likitha, you could use CollectionUtils.isEmpty for this conditional.
It returns true if the List is empty or null.
Thanks.
Documentation:
https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/CollectionUtils.html#isEmpty%28java.util.Collection%29
> [VMware] VM is not accessible after a migration across clusters.
> ----------------------------------------------------------------
>
> Key: CLOUDSTACK-8609
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8609
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Likitha Shetty
> Assignee: Likitha Shetty
> Fix For: 4.6.1
>
>
> +Steps to reproduce+
> 1. Deploy a VMware zone with 2 clusters (a host each, H1 and H2) and one
> zone-wide primary storage spanning the two clusters.
> 2. Deploy a VM (VM1) on one of the hosts (H1).
> 3. Stop VM1.
> 4. Make the host that contains the VM unsuitable for further VM deployments
> - host runs out of capacity (cpu/memory)
> - host has maximum VMs deployed on it
> 5. Start VM1.
> 6. VM will be powered on H2 but will not be accessible because the .vmx and
> other VM files associated with the VM have been deleted.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)