Check-in [9fea10a806]
Not logged in
Overview
Comment:Now stop --hard doesn't throw exception. vws list correctly shows user net mode for stopped VM
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9fea10a8060543df67edc0a056354d1d7107226b
User & Date: vitus on 2016-04-15 16:35:33
Other Links: manifest | tags
Context
2016-04-15
16:45
Added init script check-in: e5502a4893 user: vitus tags: trunk
16:35
Now stop --hard doesn't throw exception. vws list correctly shows user net mode for stopped VM check-in: 9fea10a806 user: vitus tags: trunk
15:15
Improved docs, removed forgotten debug output check-in: b31d32b79f user: vitus tags: trunk
Changes

Modified vws from [7d117d71fe] to [8063972d8f].

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    fcntl.flock(sock, fcntl.LOCK_EX)
    try:
        sock.send(command + "\n")
        answer = ""
        while not answer.endswith("(qemu) "):
            chunk = sock.recv(1024)
            if chunk == '':
                raise IOError("Unexpected EOF From monitor")
            answer += chunk
    finally:
        fcntl.flock(sock, fcntl.LOCK_UN)
    return answer

def spiceurl(sock):
    """ Returns spice URI for given (as set of parsed args) VM """







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    fcntl.flock(sock, fcntl.LOCK_EX)
    try:
        sock.send(command + "\n")
        answer = ""
        while not answer.endswith("(qemu) "):
            chunk = sock.recv(1024)
            if chunk == '':
                raise IOError("Unexpected EOF from monitor")
            answer += chunk
    finally:
        fcntl.flock(sock, fcntl.LOCK_UN)
    return answer

def spiceurl(sock):
    """ Returns spice URI for given (as set of parsed args) VM """
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
    answer = send_command(sock, "info block")
    return re.search(": /tmp", answer) is not None

def read_netinfo(filename):
    """ Reads network information from start script """
    with open(filename,"r") as f:
       for line in f:
          match=re.search("-net nic,macaddr=(\\S+) -net ([^,]+)",line)
          if match:
              f={"mac":match.group(1)}
              if match.group(2) == "user":
                   f["iface"]="user"
              elif match.group(2) == "bridge":
                   f["iface"]=re.search("br=(\\S+)",line).group(1)
              else:







|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
    answer = send_command(sock, "info block")
    return re.search(": /tmp", answer) is not None

def read_netinfo(filename):
    """ Reads network information from start script """
    with open(filename,"r") as f:
       for line in f:
          match=re.search("-net nic,macaddr=(\\S+) -net ([^, ]+)",line)
          if match:
              f={"mac":match.group(1)}
              if match.group(2) == "user":
                   f["iface"]="user"
              elif match.group(2) == "bridge":
                   f["iface"]=re.search("br=(\\S+)",line).group(1)
              else:
214
215
216
217
218
219
220

221






222
223
224
225
226
227
228
        os.system((config.get('tools', 'viewer') + "&") % uri)
    elif not options.stopped:
        print >>sys.stderr, "VM already running"

def cmd_stop(options):
    """ vws stop """
    if snapshot_mode(options.sock) or options.hard:

        print send_command(options.sock, 'quit')






    else:
        print send_command(options.sock, 'system_powerdown')

def cmd_monitor(options):
    """ vws monitor """
    try:
        print "(qemu) ",







>
|
>
>
>
>
>
>







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
        os.system((config.get('tools', 'viewer') + "&") % uri)
    elif not options.stopped:
        print >>sys.stderr, "VM already running"

def cmd_stop(options):
    """ vws stop """
    if snapshot_mode(options.sock) or options.hard:
        try:
           send_command(options.sock, 'quit')
        except IOError as e:
           # Expect IOError here
           if e.message.find("EOF from monitor"):
                print "monitor socket closed"
           else:
                raise e
    else:
        print send_command(options.sock, 'system_powerdown')

def cmd_monitor(options):
    """ vws monitor """
    try:
        print "(qemu) ",