@Override public StopAnswer execute(StopCommand cmd) { String vmName = cmd.getVmName(); try { OvmVm.Details vm = null; try { vm = OvmVm.getDetails(_conn, vmName); } catch (XmlRpcException e) { s_logger.debug("Unable to get details of vm: " + vmName + ", treating it as stopped", e); return new StopAnswer(cmd, "success", true); } deleteAllNetworkRulesForVm(vmName); OvmVm.stop(_conn, vmName); cleanup(vm); return new StopAnswer(cmd, "success", true); } catch (Exception e) { s_logger.debug("Stop " + vmName + "failed", e); return new StopAnswer(cmd, e.getMessage(), false); } }
@Override public Answer execute(final StopCommand command, final CitrixResourceBase citrixResourceBase) { final String vmName = command.getVmName(); String platformstring = null; try { final String result = citrixResourceBase.callHostPlugin(conn, "vmops", "destroy_network_rules_for_vm", "vmName", command.getVmName()); if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) { s_logger.warn("Failed to remove network rules for vm " + command.getVmName()); } else { s_logger.info("Removed network rules for vm " + command.getVmName()); final String msg = "Catch exception " + e.getClass().getName() + " when stop VM:" + command.getVmName() + " due to " + e.toString(); s_logger.debug(msg); return new StopAnswer(command, msg, platformstring, false); final SR sr = citrixResourceBase.getISOSRbyVmName(conn, command.getVmName()); citrixResourceBase.removeSR(conn, sr);
@Override public Answer execute(final StopCommand command, final LibvirtComputingResource libvirtComputingResource) { final String vmName = command.getVmName(); try { final Connect conn = libvirtUtilitiesHelper.getConnectionByVmName(vmName); final Domain vm = conn.domainLookupByName(command.getVmName()); if (vm != null && vm.getInfo().state == DomainState.VIR_DOMAIN_RUNNING) { return new StopAnswer(command, "vm is still running on host", false);
String vmName = cmd.getVmName(); State state = State.Error; hypervisorsupport.setVmState(vmName, State.Stopping);