Check-in [6438e10b80]
Not logged in
Overview
Comment:Fix typo in the find_vm
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6438e10b8008921af90e62a82ce0158f8233193d
User & Date: vitus on 2016-02-10 15:57:14
Other Links: manifest | tags
References
2016-02-10
16:00 Fixed ticket [4de4c57599]: Relative paths in the cdrom command don't work plus 5 other changes artifact: ed7eed2410 user: vitus
Context
2016-02-22
10:10
Fix handling of relative path in --install option of create command check-in: 32b7960ce4 user: vitus tags: trunk
2016-02-10
15:57
Fix typo in the find_vm check-in: 6438e10b80 user: vitus tags: trunk
2015-12-23
19:39
added Makefile and man page for find_free_port check-in: 93ffba148e user: vitus tags: trunk
Changes

Modified vws from [d924e4bebd] to [aef2c0a5d5].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
                   config.get("directories", "SharedVMs"),
                   config.get("directories", "AutostartVMs")]
    for dirname in search_path:
        if not os.access(dirname, os.X_OK):
            continue
        if (name in os.listdir(dirname) and
                os.access(os.path.join(dirname, name, "start"), os.X_OK)):
            return os.path.join(dirname, + name)
    raise ValueError("Machine %s not found." % name)


def connect_vm(vm_dir):
    """ Connects to monitor of VM in vm_dir and returns connected socket"""
    sock = socket.socket(socket.AF_UNIX)
    monitor_path = os.path.join(vm_dir, "monitor")







|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
                   config.get("directories", "SharedVMs"),
                   config.get("directories", "AutostartVMs")]
    for dirname in search_path:
        if not os.access(dirname, os.X_OK):
            continue
        if (name in os.listdir(dirname) and
                os.access(os.path.join(dirname, name, "start"), os.X_OK)):
            return os.path.join(dirname,  name)
    raise ValueError("Machine %s not found." % name)


def connect_vm(vm_dir):
    """ Connects to monitor of VM in vm_dir and returns connected socket"""
    sock = socket.socket(socket.AF_UNIX)
    monitor_path = os.path.join(vm_dir, "monitor")
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
                    result.append(match.group(1))
    return result

def snapshot_mode(sock):
    """ Returns True if VM is running in snapshot mode """
    answer = send_command(sock, "info block")
    return re.search(": /tmp", answer) is not None


#
# command implementation
#

def cmd_spiceuri(options):
    """ vws spiceuri """
    print spiceurl(options)


def cmd_start(options):
    """ vws start """
    if options.stopped:
        arg = ""
        if options.cdrom:
            arg = " -cdrom " + options.cdrom[0]
        if options.snapshot:
            arg = arg+" -snapshot"
        if options.args:
            arg = arg + " " + "".join(options.args)
        print arg
        cwd = os.getcwd()
        os.chdir(options.dir)







>















|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
                    result.append(match.group(1))
    return result

def snapshot_mode(sock):
    """ Returns True if VM is running in snapshot mode """
    answer = send_command(sock, "info block")
    return re.search(": /tmp", answer) is not None


#
# command implementation
#

def cmd_spiceuri(options):
    """ vws spiceuri """
    print spiceurl(options)


def cmd_start(options):
    """ vws start """
    if options.stopped:
        arg = ""
        if options.cdrom:
            arg = " -cdrom " + os.path.abspath(options.cdrom[0])
        if options.snapshot:
            arg = arg+" -snapshot"
        if options.args:
            arg = arg + " " + "".join(options.args)
        print arg
        cwd = os.getcwd()
        os.chdir(options.dir)
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
    if options.file == "":
        print >>sys.stderr, "Please specify either --eject or iso image"
        sys.exit(1)
    if options.file is None:
        answer = send_command(options.sock, "eject " + options.id)
    else:
        answer = send_command(options.sock, "change %s %s" %
                              (options.id, options.file))
    print answer

def find_usb(options, devices):
    """ Search for pattern or address given in options in the
        given list of devices.
        List should be produced by get_host_devices() or
        get_vm_devices()







|







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
    if options.file == "":
        print >>sys.stderr, "Please specify either --eject or iso image"
        sys.exit(1)
    if options.file is None:
        answer = send_command(options.sock, "eject " + options.id)
    else:
        answer = send_command(options.sock, "change %s %s" %
                              (options.id, os.path.abspath(options.file)))
    print answer

def find_usb(options, devices):
    """ Search for pattern or address given in options in the
        given list of devices.
        List should be produced by get_host_devices() or
        get_vm_devices()