Beispiel #1
0
 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));
 }
Beispiel #2
0
 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);
 }