• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VirtualMachineSnapshotTree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vmware.vim25.VirtualMachineSnapshotTree的典型用法代码示例。如果您正苦于以下问题:Java VirtualMachineSnapshotTree类的具体用法?Java VirtualMachineSnapshotTree怎么用?Java VirtualMachineSnapshotTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VirtualMachineSnapshotTree类属于com.vmware.vim25包,在下文中一共展示了VirtualMachineSnapshotTree类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: searchSnapshot

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
private static ManagedObjectReference searchSnapshot(
        List<VirtualMachineSnapshotTree> tree, String id) {

    if (tree == null) {
        return null;
    }

    for (VirtualMachineSnapshotTree snapshot : tree) {
        if (snapshot.getSnapshot().getValue().equals(id)) {
            return snapshot.getSnapshot();
        }
        ManagedObjectReference mor = searchSnapshot(
                snapshot.getChildSnapshotList(), id);
        if (mor != null) {
            return mor;
        }
    }

    return null;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:21,代码来源:VMwareClient.java


示例2: processSnapshot

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
private void processSnapshot(VirtualMachineSnapshotTree current, String parentLink,
        EnumerationProgress enumerationProgress,
        VmOverlay vm, String vmSelfLink) {
    QueryTask task = queryForSnapshot(enumerationProgress, current.getId().toString(),
            vmSelfLink);
    withTaskResults(task, (ServiceDocumentQueryResult result) -> {
        SnapshotState snapshotState = constructSnapshot(current, parentLink, vmSelfLink,
                enumerationProgress, vm);
        if (result.documentLinks.isEmpty()) {
            createSnapshot(snapshotState)
                    .thenCompose(createdSnapshotState ->
                        trackAndProcessChildSnapshots(current, enumerationProgress, vm, vmSelfLink,
                              createdSnapshotState));
        } else {
            SnapshotState oldState = convertOnlyResultToDocument(result, SnapshotState.class);
            updateSnapshot(enumerationProgress, vm, oldState, snapshotState, current.getId().toString())
                    .thenCompose(updatedSnapshotState ->
                        trackAndProcessChildSnapshots(current, enumerationProgress, vm, vmSelfLink,
                              updatedSnapshotState));
        }
        enumerationProgress.getSnapshotTracker().arrive();
    });
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:24,代码来源:VSphereAdapterResourceEnumerationService.java


示例3: getSnapshotInTree

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
static VirtualMachineSnapshot getSnapshotInTree(
    VirtualMachine vm, String snapName)
{
  if (vm == null || snapName == null) 
  {
    return null;
  }

  VirtualMachineSnapshotTree[] snapTree = 
      vm.getSnapshot().getRootSnapshotList();
  if(snapTree!=null)
  {
    ManagedObjectReference mor = findSnapshotInTree(
        snapTree, snapName);
    if(mor!=null)
    {
      return new VirtualMachineSnapshot(
          vm.getServerConnection(), mor);
    }
  }
  return null;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:23,代码来源:VMSnapshot.java


示例4: removeAllSnapshots

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public boolean removeAllSnapshots() throws Exception {
    VirtualMachineSnapshotInfo snapshotInfo = getSnapshotInfo();

    if (snapshotInfo != null && snapshotInfo.getRootSnapshotList() != null) {
        List<VirtualMachineSnapshotTree> tree = snapshotInfo.getRootSnapshotList();
        for (VirtualMachineSnapshotTree treeNode : tree) {
            ManagedObjectReference morTask = _context.getService().removeSnapshotTask(treeNode.getSnapshot(), true, true);
            boolean result = _context.getVimClient().waitForTask(morTask);
            if (result) {
                _context.waitForTaskProgressDone(morTask);
            } else {
                s_logger.error("VMware removeSnapshot_Task failed due to " + TaskMO.getTaskFailureInfo(_context, morTask));
                return false;
            }
        }
    }

    return true;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VirtualMachineMO.java


示例5: findSnapshotInTree

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public static ManagedObjectReference findSnapshotInTree(List<VirtualMachineSnapshotTree> snapTree, String findName) {
    assert (findName != null);

    ManagedObjectReference snapMor = null;
    if (snapTree == null)
        return snapMor;

    for (int i = 0; i < snapTree.size() && snapMor == null; i++) {
        VirtualMachineSnapshotTree node = snapTree.get(i);

        if (node.getName().equals(findName)) {
            snapMor = node.getSnapshot();
        } else {
            List<VirtualMachineSnapshotTree> childTree = node.getChildSnapshotList();
            snapMor = findSnapshotInTree(childTree, findName);
        }
    }
    return snapMor;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:20,代码来源:VmwareHelper.java


示例6: removeVirtualMachineSnapshot

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public void removeVirtualMachineSnapshot(VirtualMachine vm, String nameVm) throws Exception {
	logger.info("Launching old snapshot removing process for {}", nameVm);
	if(vm.getSnapshot() != null) {
		logger.info("Deleting snapshot ...");
		VirtualMachineSnapshotTree[] _stree = vm.getSnapshot().getRootSnapshotList();
	    if(_stree != null) {
	    	for(VirtualMachineSnapshotTree _st : _stree) {
	    		if(_st.getName().equals(nameVm)) {
	    			logger.info("Old snahpot {} found");
	    			VirtualMachineSnapshot _vmsSnap = new VirtualMachineSnapshot(vm.getServerConnection(), _st.getSnapshot());
	    			Task _taskSnap = _vmsSnap.removeSnapshot_Task(true);
	    			logger.info("Removing process launched...");
		    		if(_taskSnap.waitForTask() != Task.SUCCESS) {
		    			logger.error("Error on snapshot removing process. {}",_taskSnap.getTaskInfo().getError().getLocalizedMessage());
		    			throw new Exception(_taskSnap.getTaskInfo().getError().getLocalizedMessage());
		    		}
		    		logger.info("Snapshot removed successfully");
	    		}
	    	}
	    }
	}
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:23,代码来源:HypervisorManagerVMware.java


示例7: getRootSnapshotList

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public List<VirtualMachineSnapshotTree> getRootSnapshotList() {
    ArrayOfVirtualMachineSnapshotTree arrayOfVirtualMachineSnapshotTree = (ArrayOfVirtualMachineSnapshotTree) getOrDefault(
            VimPath.vm_snapshot_rootSnapshotList, null);
    if (arrayOfVirtualMachineSnapshotTree != null) {
        return arrayOfVirtualMachineSnapshotTree.getVirtualMachineSnapshotTree();
    }
    return null;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:9,代码来源:VmOverlay.java


示例8: processSnapshots

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
private void processSnapshots(EnumerationProgress enumerationProgress, VmOverlay vm,
        String vmSelfLink) {
    if (vmSelfLink != null) {
        List<VirtualMachineSnapshotTree> rootSnapshotList = vm.getRootSnapshotList();
        if (rootSnapshotList != null) {
            enumerationProgress.getSnapshotTracker().register();
            for (VirtualMachineSnapshotTree snapshotTree : rootSnapshotList) {
                processSnapshot(snapshotTree, null, enumerationProgress, vm,
                        vmSelfLink);
            }
        }
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:14,代码来源:VSphereAdapterResourceEnumerationService.java


示例9: trackAndProcessChildSnapshots

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
private DeferredResult<Object> trackAndProcessChildSnapshots(VirtualMachineSnapshotTree current,
        EnumerationProgress enumerationProgress,
        VmOverlay vm, String vmSelfLink, SnapshotState updatedSnapshotState) {
    trackSnapshot(enumerationProgress, vm);
    List<VirtualMachineSnapshotTree> childSnapshotList = current.getChildSnapshotList();
    if (!CollectionUtils.isEmpty(childSnapshotList)) {
        for (VirtualMachineSnapshotTree childSnapshot : childSnapshotList) {
            enumerationProgress.getSnapshotTracker().register();
            processSnapshot(childSnapshot, updatedSnapshotState.documentSelfLink,
                    enumerationProgress, vm, vmSelfLink);
        }
    }
    return DeferredResult.completed(null);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:15,代码来源:VSphereAdapterResourceEnumerationService.java


示例10: constructSnapshot

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
private SnapshotState constructSnapshot(VirtualMachineSnapshotTree current, String parentLink,
        String vmSelfLink, EnumerationProgress enumerationProgress,
        VmOverlay vm) {
    SnapshotState snapshot = new SnapshotState();
    snapshot.computeLink = vmSelfLink;
    snapshot.parentLink = parentLink;
    snapshot.description = current.getDescription();
    //TODO how to determine if the snapshot is current
    //snapshot.isCurrent = current.isQuiesced()
    snapshot.creationTimeMicros = current.getCreateTime().toGregorianCalendar().getTimeInMillis();
    //TODO How to fetch custom properties
    //snapshot.customProperties = current.get
    //TODO what are snapshot grouplinks
    //snapshot.groupLinks
    snapshot.name = current.getName();
    snapshot.regionId = enumerationProgress.getRegionId();
    snapshot.id = current.getId().toString();
    populateTags(enumerationProgress, vm, snapshot);
    snapshot.tenantLinks = enumerationProgress.getTenantLinks();
    if (snapshot.endpointLinks == null) {
        snapshot.endpointLinks = new HashSet<String>();
    }
    snapshot.endpointLinks.add(enumerationProgress.getRequest().endpointLink);
    CustomProperties.of(snapshot)
            .put(CustomProperties.MOREF, VimUtils.convertMoRefToString(current.getSnapshot()))
            .put(CustomProperties.TYPE, current.getSnapshot().getType());
    return snapshot;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:29,代码来源:VSphereAdapterResourceEnumerationService.java


示例11: findSnapshotInTree

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
static ManagedObjectReference findSnapshotInTree(
    VirtualMachineSnapshotTree[] snapTree, String snapName)
{
  for(int i=0; i <snapTree.length; i++) 
  {
    VirtualMachineSnapshotTree node = snapTree[i];
    if(snapName.equals(node.getName()))
    {
      return node.getSnapshot();
    } 
    else 
    {
      VirtualMachineSnapshotTree[] childTree = 
          node.getChildSnapshotList();
      if(childTree!=null)
      {
        ManagedObjectReference mor = findSnapshotInTree(
            childTree, snapName);
        if(mor!=null)
        {
          return mor;
        }
      }
    }
  }
  return null;
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:28,代码来源:VMSnapshot.java


示例12: listSnapshots

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
static void listSnapshots(VirtualMachine vm)
{
  if(vm==null)
  {
    return;
  }
  VirtualMachineSnapshotInfo snapInfo = vm.getSnapshot();
  VirtualMachineSnapshotTree[] snapTree = 
    snapInfo.getRootSnapshotList();
  printSnapshots(snapTree);
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:12,代码来源:VMSnapshot.java


示例13: printSnapshots

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
static void printSnapshots(
    VirtualMachineSnapshotTree[] snapTree)
{
  for (int i = 0; snapTree!=null && i < snapTree.length; i++) 
  {
    VirtualMachineSnapshotTree node = snapTree[i];
    System.out.println("Snapshot Name : " + node.getName());           
    VirtualMachineSnapshotTree[] childTree = 
      node.getChildSnapshotList();
    if(childTree!=null)
    {
      printSnapshots(childTree);
    }
  }
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:16,代码来源:VMSnapshot.java


示例14: getSnapshotMor

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public ManagedObjectReference getSnapshotMor(String snapshotName) throws Exception {
    VirtualMachineSnapshotInfo info = getSnapshotInfo();
    if (info != null) {
        List<VirtualMachineSnapshotTree> snapTree = info.getRootSnapshotList();
        return VmwareHelper.findSnapshotInTree(snapTree, snapshotName);
    }
    return null;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:9,代码来源:VirtualMachineMO.java


示例15: hasSnapshot

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public boolean hasSnapshot() throws Exception {
    VirtualMachineSnapshotInfo info = getSnapshotInfo();
    if (info != null) {
        ManagedObjectReference currentSnapshot = info.getCurrentSnapshot();
        if (currentSnapshot != null) {
            return true;
        }
        List<VirtualMachineSnapshotTree> rootSnapshotList = info.getRootSnapshotList();
        if (rootSnapshotList != null && rootSnapshotList.size() > 0) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:15,代码来源:VirtualMachineMO.java


示例16: getSnapshotList

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
@NotNull
Map<String, VirtualMachineSnapshotTree> getSnapshotList(String vmName) throws VmwareCheckedCloudException;
 
开发者ID:JetBrains,项目名称:teamcity-vmware-plugin,代码行数:3,代码来源:VMWareApiConnector.java


示例17: getVirtualMachine

import com.vmware.vim25.VirtualMachineSnapshotTree; //导入依赖的package包/类
public Map<String, String> getVirtualMachine(String name) throws Exception {
	if(name == null || name.isEmpty()) {
		throw new Exception("invalid virtual machine name");
	}
	
	Map<String,String> _machine = new HashMap<String, String>();
	ServiceInstance si = new ServiceInstance(new URL(this._url), this._user, this._password, true);
	try {
		Folder rootFolder = si.getRootFolder();
		VirtualMachine _vm = (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", name);
		if(_vm == null) {
			throw new Exception("virtual machine not found");
		}
		
		StringBuilder _sb = new StringBuilder();
    	_machine.put("name", _vm.getName());
    	for(Datastore _ds : _vm.getDatastores()) {
    		if(_sb.length() > 0) {
    			_sb.append(":");
    		}
    		_sb.append(_ds.getName());
    	}
    	_machine.put("datastore", _sb.toString());
    	_sb = new StringBuilder();
    	for(Network _nw : _vm.getNetworks()) {
    		if(_sb.length() > 0) {
    			_sb.append(":");
    		}
    		_sb.append(_nw.getName());
    	}
    	_machine.put("network", _sb.toString());
    	_sb = new StringBuilder();
    	VirtualMachineSnapshotTree[] _stree = _vm.getSnapshot().getRootSnapshotList();
	    if(_stree != null) {
	    	for(VirtualMachineSnapshotTree _st : _stree) {
	    		if(_sb.length() > 0) {
	    			_sb.append(":");
	    		}
	    		_sb.append(_st.getName());
	    	}
	    	_machine.put("snapshot", _sb.toString());
	    } else {
	    	_machine.put("snapshot", "");
	    }
    	
	} catch(Exception _ex) {
		throw new Exception("hypervisor error - " + _ex.getMessage());
	} finally {
		si.getServerConnection().logout();
	}
	return _machine;
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:53,代码来源:HypervisorManagerVMware.java



注:本文中的com.vmware.vim25.VirtualMachineSnapshotTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConditionFactory类代码示例发布时间:2022-05-23
下一篇:
Java HttpRequestBuilder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap