Diff
Not logged in

Differences From Artifact [45822981f1]:

To Artifact [b8e18e84bc]:


93
94
95
96
97
98
99



100
101
102
103
104
105
106
            if (re.match("\s*-drive .*",line) and
                line.find("media=disk")>-1):
                m=re.search("file=([^,\s]*)",line)
                if m:
                    result.append(m.group(1))
    return result





#
# command implementation
#

def cmd_spiceuri(options):
    print spiceurl(options)







>
>
>







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
            if (re.match("\s*-drive .*",line) and
                line.find("media=disk")>-1):
                m=re.search("file=([^,\s]*)",line)
                if m:
                    result.append(m.group(1))
    return result

def snapshot_mode(sock):
    answer=send_command(sock,"info block")
    return re.search(": /tmp",answer) is not None:

#
# command implementation
#

def cmd_spiceuri(options):
    print spiceurl(options)
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
            cmd_cdrom(options)    
    if options.gui:
        uri = spiceurl(options)
        os.system((config.get('tools','viewer')+"&") % uri)
    elif not options.stopped:
        print >>sys.stderr,"VM already running"
def cmd_stop(options):
    if options.hard:
        print send_command(options.sock,'quit')
    else:
        print send_command(options.sock,'system_powerdown')
def cmd_monitor(options):
    try:
        print "(qemu) ",
        sys.stdout.flush()







|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
            cmd_cdrom(options)    
    if options.gui:
        uri = spiceurl(options)
        os.system((config.get('tools','viewer')+"&") % uri)
    elif not options.stopped:
        print >>sys.stderr,"VM already running"
def cmd_stop(options):
    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):
    try:
        print "(qemu) ",
        sys.stdout.flush()
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
            sys.exit(1)
        
    else:
        #
        #
        # Check if we are running in the snapshot mode
        # 
        answer=send_command(options.sock,"info block")
        if re.search(": /tmp",answer):
            send_command(options.sock,"commit")
        else:
            print >>sys.stderr,"VM is not running in snapshot mode"
            sys.exit(1)

    








|
<







394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
            sys.exit(1)
        
    else:
        #
        #
        # Check if we are running in the snapshot mode
        # 
        if snapshot_mode(options.sock): 

            send_command(options.sock,"commit")
        else:
            print >>sys.stderr,"VM is not running in snapshot mode"
            sys.exit(1)