Search in sources :

Example 1 with VmfsDatastoreExpandSpec

use of com.vmware.vim25.VmfsDatastoreExpandSpec in project coprhd-controller by CoprHD.

the class HostStorageAPI method pickBestExpandSpec.

/**
 * Picks the best expand spec. This picks an expand spec that uses the given disk.
 *
 * @param disk the disk that was expanded.
 * @param expandOptions the available expand options.
 * @return the expand spec.
 */
public VmfsDatastoreExpandSpec pickBestExpandSpec(HostScsiDisk disk, List<VmfsDatastoreOption> expandOptions) {
    if ((expandOptions == null) || expandOptions.isEmpty()) {
        return null;
    }
    for (VmfsDatastoreOption option : expandOptions) {
        VmfsDatastoreExpandSpec spec = (VmfsDatastoreExpandSpec) option.getSpec();
        String diskName = spec.getExtent().getDiskName();
        if (StringUtils.equals(diskName, disk.getCanonicalName())) {
            return spec;
        }
    }
    return null;
}
Also used : VmfsDatastoreExpandSpec(com.vmware.vim25.VmfsDatastoreExpandSpec) VmfsDatastoreOption(com.vmware.vim25.VmfsDatastoreOption)

Example 2 with VmfsDatastoreExpandSpec

use of com.vmware.vim25.VmfsDatastoreExpandSpec in project coprhd-controller by CoprHD.

the class HostStorageAPI method getVmfsDatastoreExpandSpec.

/**
 * Gets the best VMFS datastore expand spec.
 *
 * @param datastore the datastore.
 * @return the VMFS datastore expand spec.
 */
public VmfsDatastoreExpandSpec getVmfsDatastoreExpandSpec(HostScsiDisk disk, Datastore datastore) {
    List<VmfsDatastoreOption> expandOptions = queryVmfsDatastoreExpandOptions(datastore);
    VmfsDatastoreExpandSpec extendSpec = pickBestExpandSpec(disk, expandOptions);
    if (extendSpec == null) {
        throw new VMWareException("No VMFS datastore expand spec");
    }
    return extendSpec;
}
Also used : VmfsDatastoreExpandSpec(com.vmware.vim25.VmfsDatastoreExpandSpec) VmfsDatastoreOption(com.vmware.vim25.VmfsDatastoreOption)

Example 3 with VmfsDatastoreExpandSpec

use of com.vmware.vim25.VmfsDatastoreExpandSpec in project cloudstack by apache.

the class VmwareStorageProcessor method expandDatastore.

public void expandDatastore(HostDatastoreSystemMO hostDatastoreSystem, DatastoreMO datastoreMO) throws Exception {
    List<VmfsDatastoreOption> vmfsDatastoreOptions = hostDatastoreSystem.queryVmfsDatastoreExpandOptions(datastoreMO);
    if (vmfsDatastoreOptions != null && vmfsDatastoreOptions.size() > 0) {
        VmfsDatastoreExpandSpec vmfsDatastoreExpandSpec = (VmfsDatastoreExpandSpec) vmfsDatastoreOptions.get(0).getSpec();
        hostDatastoreSystem.expandVmfsDatastore(datastoreMO, vmfsDatastoreExpandSpec);
    }
}
Also used : VmfsDatastoreExpandSpec(com.vmware.vim25.VmfsDatastoreExpandSpec) VmfsDatastoreOption(com.vmware.vim25.VmfsDatastoreOption)

Aggregations

VmfsDatastoreExpandSpec (com.vmware.vim25.VmfsDatastoreExpandSpec)3 VmfsDatastoreOption (com.vmware.vim25.VmfsDatastoreOption)3