Index: vws ================================================================== --- vws +++ vws @@ -199,10 +199,35 @@ elif nxt == 1: nxt = 0 snapshot_id = line[:line.index(' ')] arg = arg + " -loadvm " + snapshot_id break + # Check for correct brige name + try: + os.stat("monitor") + except OSError: + # We cannot find monitor socket. So this machine might be + # never run on this host + f=open("start","r+") + data=f.read() + idx0=data.find("-net bridge,br=") + if idx != -1: + idx=data.find("=",idx) + idx+=1 + idx2=data.find(" ",idx) + bridgename=data[idx:idx2] + if not bridgename in list_bridges(): + net = config.get("create options","net") + if net== "user": + data=data[:idx0]+"-net user"+data[idx2:] + else: + data=data[:idx]+net+data[idx2:] + f.seek(0) + f.write(data) + f.truncate() + f.close() + os.system("./start%s" % arg) os.chdir(cwd) time.sleep(2) options.sock = connect_vm(options.dir) Index: vws.service.in ================================================================== --- vws.service.in +++ vws.service.in @@ -5,8 +5,9 @@ [Service] Type=forking ExecStart=@bindir@/vws autostart ExecStop=@bindir@/vws shutdown --wait Restart=no +RemainAfterExit=yes [Install] WantedBy=multi-user.target Alias=vws.service