コード例 #1
0
ファイル: Reset.java プロジェクト: 4v4t4r/vmware-cli
 public void execute(IOutputer outputer, String[] args) throws Exception {
   if (args.length != 1) {
     throw new SyntaxError();
   }
   VmLocation vmLocation = new VmLocation(args[0]);
   VimServiceUtil vimServiceUtil = VimServiceUtil.get(vmLocation.getEsxName());
   VmInfo vmInfo = VmsListService.findVmByName(vimServiceUtil, vmLocation.getVmName());
   outputer.log(
       "Reset virtual machine " + vmInfo.getName() + " on host " + vmLocation.getEsxName());
   ManagedObjectReference task =
       vimServiceUtil.getService().resetVMTask(vmInfo.getManagedObjectReference());
   outputer.result(PropertiesService.waitForTaskEnd(vimServiceUtil, task));
 }
コード例 #2
0
ファイル: ShutdownGuest.java プロジェクト: bpaquet/vmware-cli
 public void execute(IOutputer outputer, String[] args) throws Exception {
   if (args.length != 1) {
     throw new SyntaxError();
   }
   VmLocation vmLocation = new VmLocation(args[0]);
   VimServiceUtil vimServiceUtil = VimServiceUtil.get(vmLocation.getEsxName());
   VmInfo vmInfo = VmsListService.findVmByName(vimServiceUtil, vmLocation.getVmName());
   outputer.log(
       "Shutdown guest virtual machine "
           + vmInfo.getName()
           + " on host "
           + vmLocation.getEsxName());
   vimServiceUtil.getService().shutdownGuest(vmInfo.getManagedObjectReference());
   outputer.result(true);
 }