Search in sources :

Example 46 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class HypervisorHostHelper method waitForNetworkReady.

public static ManagedObjectReference waitForNetworkReady(HostMO hostMo, String networkName, long timeOutMs) throws Exception {
    ManagedObjectReference morNetwork = null;
    // if portGroup is just created, getNetwork may fail to retrieve it, we
    // need to retry
    long startTick = System.currentTimeMillis();
    while (System.currentTimeMillis() - startTick <= timeOutMs) {
        morNetwork = hostMo.getNetworkMor(networkName);
        if (morNetwork != null) {
            break;
        }
        s_logger.info("Waiting for network " + networkName + " to be ready");
        Thread.sleep(1000);
    }
    return morNetwork;
}
Also used : ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 47 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class VirtualDiskManagerMO method extendVirtualDisk.

public void extendVirtualDisk(String name, ManagedObjectReference morDc, long newCapacityKb, boolean eagerZero) throws Exception {
    ManagedObjectReference morTask = _context.getService().extendVirtualDisk_Task(_mor, name, morDc, newCapacityKb, eagerZero);
    String result = _context.getServiceUtil().waitForTask(morTask);
    if (!result.equals("sucess"))
        throw new Exception("Unable to extend virtual disk " + name + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
    _context.waitForTaskProgressDone(morTask);
}
Also used : ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 48 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class VirtualDiskManagerMO method zeroFillVirtualDisk.

public void zeroFillVirtualDisk(String name, ManagedObjectReference morDc) throws Exception {
    ManagedObjectReference morTask = _context.getService().zeroFillVirtualDisk_Task(_mor, name, morDc);
    String result = _context.getServiceUtil().waitForTask(morTask);
    if (!result.equals("sucess"))
        throw new Exception("Unable to zero fill virtual disk " + name + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
    _context.waitForTaskProgressDone(morTask);
}
Also used : ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 49 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class VirtualDiskManagerMO method deleteVirtualDisk.

public void deleteVirtualDisk(String name, ManagedObjectReference morDc) throws Exception {
    ManagedObjectReference morTask = _context.getService().deleteVirtualDisk_Task(_mor, name, morDc);
    String result = _context.getServiceUtil().waitForTask(morTask);
    if (!result.equals("sucess"))
        throw new Exception("Unable to delete virtual disk " + name + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
    _context.waitForTaskProgressDone(morTask);
}
Also used : ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Example 50 with ManagedObjectReference

use of com.vmware.vim25.ManagedObjectReference in project CloudStack-archive by CloudStack-extras.

the class VirtualDiskManagerMO method moveVirtualDisk.

public void moveVirtualDisk(String srcName, ManagedObjectReference morSrcDc, String destName, ManagedObjectReference morDestDc, boolean force) throws Exception {
    ManagedObjectReference morTask = _context.getService().moveVirtualDisk_Task(_mor, srcName, morSrcDc, destName, morDestDc, force);
    String result = _context.getServiceUtil().waitForTask(morTask);
    if (!result.equals("sucess"))
        throw new Exception("Unable to move virtual disk " + srcName + " to " + destName + " due to " + TaskMO.getTaskFailureInfo(_context, morTask));
    _context.waitForTaskProgressDone(morTask);
}
Also used : ManagedObjectReference(com.vmware.vim25.ManagedObjectReference)

Aggregations

ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)236 ArrayOfManagedObjectReference (com.vmware.vim25.ArrayOfManagedObjectReference)62 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)57 Pair (com.cloud.utils.Pair)49 RemoteException (java.rmi.RemoteException)48 ArrayList (java.util.ArrayList)45 UnsupportedEncodingException (java.io.UnsupportedEncodingException)39 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)35 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)32 IOException (java.io.IOException)31 CloudException (com.cloud.exception.CloudException)30 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)30 VirtualMachineConfigSpec (com.vmware.vim25.VirtualMachineConfigSpec)29 ObjectContent (com.vmware.vim25.ObjectContent)28 VirtualDeviceConfigSpec (com.vmware.vim25.VirtualDeviceConfigSpec)27 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)25 ConfigurationException (javax.naming.ConfigurationException)24 InternalErrorException (com.cloud.exception.InternalErrorException)23 VirtualDisk (com.vmware.vim25.VirtualDisk)23 ConnectException (java.net.ConnectException)23