/** * Attempts to delete the VM from disk. * @throws RemoteException * @throws InterruptedException */ public void removeVm() throws RemoteException, InterruptedException { try { Task task = vm.destroy_Task(); String status = task.waitForTask(); if (!status.equals("success")) { String message = task.getTaskInfo().getError() .getLocalizedMessage(); throw new RemoteException("Failed: " + message); } } catch (NotFound e) { log.warn("VM not found before attempting to delete it", e); } }
LocalizedMethodFault fault = tinfo.getError(); String error = "Error Occured"; if(fault!=null)
/** * Generate the log bundles for the specific hosts. After the task done, print all the URLs of the generated bundles. * @param si ServiceInstance object. * @param includeDefault Specifies if the bundle should include the default server. * @param hosts Lists hosts that are included. */ public void generateLogBundles(ServiceInstance si, boolean includeDefault, HostSystem[] hosts) throws Exception { DiagnosticManager diagMgr = si.getDiagnosticManager(); Task task = diagMgr.generateLogBundles_Task(includeDefault, hosts); String result = task.waitForTask(); if (Task.SUCCESS.equals(result)) { ArrayOfDiagnosticManagerBundleInfo bundleArray = (ArrayOfDiagnosticManagerBundleInfo) task.getTaskInfo().getResult(); DiagnosticManagerBundleInfo[] bundles = bundleArray.getDiagnosticManagerBundleInfo(); if (bundles != null) { System.out.println("============ Log URL ============"); for (DiagnosticManagerBundleInfo bundle : bundles) { System.out.println(bundle.getUrl()); } } else { System.out.println("No bundle generated."); } } else { throw new Exception("Generate log bundles failed: error: " + task.getTaskInfo().getError().getLocalizedMessage()); } }
public void processTask(TaskInfo taskInfo) { ViTaskContinuation<?> continuation = pendingTasks.get(taskInfo.getTask().getValue()); if (continuation != null) { switch (taskInfo.getState()) { case SUCCESS: continuation.onSuccess(); pendingTasks.remove(taskInfo.getTask().getValue()); break; case ERROR: continuation.onError(taskInfo.getError()); pendingTasks.remove(taskInfo.getTask().getValue()); break; } } }
private void handleTask(Task task) throws DestructionException, InterruptedException, RemoteException { task.waitForTask(); TaskInfo taskInfo = task.getTaskInfo(); if (TaskInfoState.error == taskInfo.getState()) { throw new DestructionException(taskInfo.getError().getLocalizedMessage()); } }
LocalizedMethodFault lmf = ti.getError(); if (lmf!=null)
LocalizedMethodFault lmf = ti.getError(); if (lmf!=null)
System.out.println(info.getError().getFault());
System.out.println(info.getError().getFault());
public void attachNic(VirtualMachine vm, VirtualEthernetCard nic, Network network) throws RemoteException, InterruptedException { VirtualEthernetCardNetworkBackingInfo backing = (VirtualEthernetCardNetworkBackingInfo) nic.getBacking(); backing.setDeviceName(network.getName()); backing.setNetwork(network.getMOR()); nic.setBacking(backing); nic.getDeviceInfo().setSummary(network.getName()); VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec(); nicSpec.setOperation(VirtualDeviceConfigSpecOperation.edit); nicSpec.setDevice(nic); VirtualDeviceConfigSpec[] configSpecs = new VirtualDeviceConfigSpec[1]; configSpecs[0] = nicSpec; VirtualMachineConfigSpec machineConfigSpec = new VirtualMachineConfigSpec(); machineConfigSpec.setDeviceChange(configSpecs); Task task = vm.reconfigVM_Task(machineConfigSpec); String status = task.waitForTask(); if (!status.equals("success")) { String message = task.getTaskInfo().getError().getLocalizedMessage(); throw new RemoteException("Failed: " + message); } }
TaskInfo info = task.getTaskInfo(); log(WARNING, "vMotion of " + targetVMName + " to " + newHostName + " failed. Error details: " + info.getError().getFault()); return false;
Log.getLogWriter().warning( "vMotion of " + targetVMName + " to " + newHostName + " failed. Error details: " + info.getError().getFault()); return false;