Package com.vmware.vim25

Examples of com.vmware.vim25.OptionValue


     */
    private HostSystem getAvailableHost(String hostName)
        throws Exception
    {

        HostSystem host = null;

        if (hostName != null) {
            List<HostSystem> hosts = getAllHostList();
            for (HostSystem h: hosts) {
                if (hostName.equals(h.getName())) {
                    host = h; break;
                }
            }
        }

        if (hostName != null && host == null) {
            logger_.warning
                (String.format("Host %s not found.", hostName));
            hostName = null;
        }
       
        if (hostName == null) {
            host = getDefaultHost();
            logger_.info(String.format
                         ("Use default host %s.", host.getName()));
        }

        if (host == null) {
            throw new Exception("host is null.");
        }
View Full Code Here


     */
    protected ManagedEntity searchManagedEntity(String type, String name)
    {
        ManagedEntity ret = null;
        try {
            ret = new InventoryNavigator
                (rootFolder_).searchManagedEntity(type, name);
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            logger_.warning(Utility.toString(e));
            return null;
        }
View Full Code Here

    {
        List<ManagedEntity> ret = new LinkedList<ManagedEntity>();
       
        ManagedEntity[] mes;
        try {
            mes = new InventoryNavigator(rootFolder_).searchManagedEntities(type);
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            return ret;
        }
        assert(mes != null);

View Full Code Here

    {
        List<ManagedEntity> ret = new LinkedList<ManagedEntity>();
       
        ManagedEntity[] mes;
        try {
            mes = new InventoryNavigator(rootFolder_).searchManagedEntities
                (new String[][] { {type, name}, }, true);
           
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            return ret;
        }
View Full Code Here

     * @param name Name of the entity.
     * @return Found managed entity in success or null in failure.
     */
    protected ManagedEntity searchManagedEntity(String type, String name)
    {
        ManagedEntity ret = null;
        try {
            ret = new InventoryNavigator
                (rootFolder_).searchManagedEntity(type, name);
        } catch (Exception e) { /* InvalidProperty, RuntimeFault, RemoteException */
            logger_.warning(Utility.toString(e));
View Full Code Here

        ManagedObjectReference mor =
            generateMoref("VirtualMachine", morefStr);
        if (mor == null) { return null; }

        ManagedEntity vm =
            MorUtil.createExactManagedEntity(si_.getServerConnection(), mor);

        if (vm instanceof VirtualMachine) {
            return (VirtualMachine) vm; /* may be null */
        } else {
View Full Code Here

        ManagedObjectReference mor =
            generateMoref("VirtualMachineSnapshot", morefStr);
        if (mor == null) { return null; }

        ManagedObject snap =
            MorUtil.createExactManagedObject(si_.getServerConnection(), mor);

        if (snap instanceof VirtualMachineSnapshot) {
            return (VirtualMachineSnapshot) snap; /* may be null */
        } else {
View Full Code Here

     */
    public void connect()
        throws Exception
    {
        logger_.info(String.format("connecting to %s...", url_));
    si_ = new ServiceInstance
            (new URL(url_), username_, password_, true);
    rootFolder_ = si_.getRootFolder();
        logger_.info("connected");
    }
View Full Code Here

            vmsnap = getSnapshotInTree(snapName);
            if (vmsnap == null) { return false; }
        }

        try {
            Task task = null;
            switch (type) {
            case CREATE:
                task = vm_.createSnapshot_Task(snapName, null, false, false);
                break;
            case DELETE:
                task = vmsnap.removeSnapshot_Task(true);
                break;
            case REVERT:
                task = vmsnap.revertToSnapshot_Task(null, true);
                break;
            default:
                throw new Exception("Snapshot TaskType is wrong.");
            }
            assert task != null;
            String ret = task.waitForTask();
            if (ret.equals("success")) {
                logger_.info(messageInSuccess);
                return true;
            } else {
                logger_.info(messageInFailure);
View Full Code Here

        vmConfigSpec.setDeviceChange
            (specList.toArray(new VirtualDeviceConfigSpec[0]));

        /* reconfigure vm task */
        try {
            Task task = vm_.reconfigVM_Task(vmConfigSpec);
            String ret = task.waitForTask();
            logger_.info(String.format("%s: addDisksToVm()\n", ret));
            if (ret.equals("success")) {
                return true;
            } else {
                return false;
View Full Code Here

TOP

Related Classes of com.vmware.vim25.OptionValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.