def stop(host, vmid): assert getState(host, vmid) != generic.State.CREATED, "VM not running" process.killPidfile(host, _pidFile(vmid)) fileutil.delete(host, _logFile(vmid)) assert getState(host, vmid) == generic.State.PREPARED, "Failed to stop VM"
def stopVnc(host, vmid, port): process.killPidfile(host, _vncPidFile(vmid)) process.killPortUser(host, port) assert process.portFree(host, port)
def stopCaptureViaNet(host, name, port): rdir = _remoteDir(name) process.killPidfile(host, "%s.net.pid" % rdir) process.killPortUser(host, port) assert process.portFree(host, port)
def stopCaptureToFile(host, name): rdir = _remoteDir(name) process.killPidfile(host, "%s.file.pid" % rdir)
def stop(host, port): assert getState(host, port) != generic.State.CREATED assert host process.killPidfile(host, _pidFile(port)) util.waitFor(lambda :getState(host, port) == generic.State.PREPARED, 5.0) assert getState(host, port) == generic.State.PREPARED
ifaceutil.ifup(host, iface) def _stopEndpoint(endpoint): state = getState(endpoint) if state != generic.State.STARTED: return host = endpoint.getHost() assert host try: host.execute("tincd --net=%s -k" % _tincName(endpoint)) except exceptions.CommandError, exc: if exc.errorCode != 1: #tincd was not running raise util.waitFor(lambda :getState(endpoint) != generic.State.STARTED, 2.0) if getState(endpoint) == generic.State.STARTED: process.killPidfile(host, _pidFile(endpoint), force=True) process.killPortUser(host, endpoint.getPort()) assert getState(endpoint) != generic.State.STARTED def _setupRouting(endpoint): host = endpoint.getHost() assert host bridge = endpoint.getBridge() assert bridge id = endpoint.getId() assert id assert ifaceutil.bridgeExists(host, bridge) tincname = _tincName(endpoint) assert ifaceutil.interfaceExists(host, tincname) assert not ifaceutil.interfaceBridge(host, tincname) #enable ip forwarding