I am trying to push a batch file to a windows 2003 VM and trying to assign a dns to it.
I am using a method GuestProcessManager.listProcessesInGuest, to get the exit code status of the batch file.
Iam getting the following error
2016-11-02 18:26:46.592 SEVERE execute - >Exception :VI SDK invoke exception:com.vmware.vim25.GuestOperationsUnavailable
2016-11-02 18:26:46.592 SEVERE execute - >com.vmware.vim25.ws.WSClient.invoke(WSClient.java:122)
2016-11-02 18:26:46.592 SEVERE execute - >com.vmware.vim25.ws.VimStub.listProcessesInGuest(VimStub.java:4025)
2016-11-02 18:26:46.592 SEVERE execute - >com.vmware.vim25.mo.GuestProcessManager.listProcessesInGuest(GuestProcessManager.java:68)
But if I try after sometime, It seems to be working fine.Any hep on this is greatly appreciated.
public GuestProcessInfo getProcessInfo(VirtualMachine vm, long pid, VMError vmerr) {
try {
GuestProcessManager procMgr = getGuestOperationsManager().getProcessManager(vm);
long[] pids = new long[1];
pids[0] = pid;
GuestProcessInfo[] procList = procMgr.listProcessesInGuest(auth, pids);
if (procList == null || procList.length == 0) {
mylog.severe("VMAPI: getProcessInfo: Pid " + pid + " no longer running and no status available");
vmerr.setErrorCode(VMErrorCodes.UDP_EXIT_VMAPI_PROCESS_TERMINATED_ERROR);
return null;
}
return procList[0];
} catch (Exception e) {
mylog.severe("VMAPI: Caught exception in getProcessInfo while getting process status for " + pid + " on VM " + vm.getName());
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
mylog.severe(sw.toString());
vmerr.setErrorCode(VMErrorCodes.UDP_EXIT_VMAPI_PROCESSSTATUS_UNKNOWN_ERROR);
return null;
}
}
Regards
Shiva