Check-in [57c08957e3]
Not logged in
Overview
Comment:documented permission setction of config file. Make autostart_user option work
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 57c08957e351d50a290eff8dd6910d190e0a08d6
User & Date: vitus on 2016-04-14 20:10:42
Other Links: manifest | tags
Context
2016-04-15
12:23
vws list --state now outputs IP and mac addresses check-in: 5b974714bc user: vitus tags: trunk
2016-04-14
20:10
documented permission setction of config file. Make autostart_user option work check-in: 57c08957e3 user: vitus tags: trunk
19:56
Added display of privare/public status and spice url to vws list command. Fixes 96cc307ed7 check-in: d72aaf8da4 user: vitus tags: trunk
Changes

Modified vws from [c2c3e866b0] to [e599101b46].

475
476
477
478
479
480
481

482



483
484
485
486
487
488
489
            print >>sys.stderr, "VM is not running in snapshot mode"
            sys.exit(1)

def cmd_autostart(options):
    """
    Starts all VMs which are in the autostart directory
    """

    dirname =  config.get("directories", "AutostartVMs")



    if not os.access(dirname,os.R_OK):
        return 
    for name in os.listdir(dirname):
        if not os.access(os.path.join(dirname,name,"start"), os.X_OK):
            continue
        machine_dir = os.path.join(dirname,name)
        sock = connect_vm(machine_dir)







>

>
>
>







475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
            print >>sys.stderr, "VM is not running in snapshot mode"
            sys.exit(1)

def cmd_autostart(options):
    """
    Starts all VMs which are in the autostart directory
    """
    import pwd
    dirname =  config.get("directories", "AutostartVMs")
    os.seteuid(pwd.getpwnam(
                            config.get("permissions","autostart_user")
                            ).pw_uid)
    if not os.access(dirname,os.R_OK):
        return 
    for name in os.listdir(dirname):
        if not os.access(os.path.join(dirname,name,"start"), os.X_OK):
            continue
        machine_dir = os.path.join(dirname,name)
        sock = connect_vm(machine_dir)

Modified vws.mkd from [9774ce70a4] to [dc1c3f9b66].

142
143
144
145
146
147
148











149
150
151
152
153
154
155
1. Make qemu-bridge-helper utility setuid root. (it is designed to run
setuid root, but Debian doesn't install it such way). It is required to
allow qemu, started from non-root user to add interface to bridge.
2. Create bridge interface to use. You can have several bridges and
specify which one would be used on VW creation. Really, by manual
editing of the startup script, you can add several network interfaces to
VW and connect them to the different bridges.











3. Setup you host system to forward packets from bridge network to
outside internet. You can either use NAT, or include your ethernet
interface into bridge.
4. Make sure DHCP server is running in the bridge network. If your
ethernet interface is part of the bridge, VWs would get their dynamic IP
from your network router. If you use NAT, you'll need to run DHCP
server, for instance **dnsmasq**(8) on your host and make it serve your bridge







>
>
>
>
>
>
>
>
>
>
>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
1. Make qemu-bridge-helper utility setuid root. (it is designed to run
setuid root, but Debian doesn't install it such way). It is required to
allow qemu, started from non-root user to add interface to bridge.
2. Create bridge interface to use. You can have several bridges and
specify which one would be used on VW creation. Really, by manual
editing of the startup script, you can add several network interfaces to
VW and connect them to the different bridges.

You should assign some MAC address to the bridge interface used by
virtual machines. 

If you ethernet interface is part of the bridge, it already have one.
Otherwise use command

   ip link set dev *bridge_name* address XX:XX:XX:XX:XX:XX

or some distribution-specific configuration file.

3. Setup you host system to forward packets from bridge network to
outside internet. You can either use NAT, or include your ethernet
interface into bridge.
4. Make sure DHCP server is running in the bridge network. If your
ethernet interface is part of the bridge, VWs would get their dynamic IP
from your network router. If you use NAT, you'll need to run DHCP
server, for instance **dnsmasq**(8) on your host and make it serve your bridge
260
261
262
263
264
265
266





267
268
269
270
271
272
273
**monitor** command running.

**vws spiceuri** *machine*

Prints out URI you should feed into your spice viewer to access this
machine.







**vws sendkey** *machine* *keyspec*

Allows to send some key combination to the virtual machine. For example
if windows screen is locked spice client is sometimes unable to deliver
key stroke to the virtual machine in order to get it out of sleep. 








>
>
>
>
>







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
**monitor** command running.

**vws spiceuri** *machine*

Prints out URI you should feed into your spice viewer to access this
machine.

**vws list** [ **--state** ]

Lists available virtual machines. If **--state** option is given, prints
out state (running or stoped) type (private or shared) and spice URI (if
machine is running).

**vws sendkey** *machine* *keyspec*

Allows to send some key combination to the virtual machine. For example
if windows screen is locked spice client is sometimes unable to deliver
key stroke to the virtual machine in order to get it out of sleep. 

303
304
305
306
307
308
309

310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327












328
329
330
331
332
333
334
==================

Configuration file for [vws], which uses standard .ini format.

There are following sections

    [directories]

    [create options]
    [tools]

Directories section
-------------------

Contain two parameters: **SharedVMs** and **AutostartVMs**. Both are directories where system-wide virtual machines are stored. 

Shared VMs are VMs which are accessible for all members of **kvm** group, but must be started or stopped manually.

Autostart VMs are started automatically on boot of host. 

If you are using more or less sensible disk layout, i.e. create separate partitions for /usr and /var, you probably want to tune this parameters, because you don't want to store your vms in the /var/cache. 

It is recommended to have both these directories on the same partition, so moving VM from autostart to shared and vice versa would not involve physically copying of the files.

**NB** *autostart is planned for version 0.3*













Create options
--------------


This section list default values, used by **vws create** to create new virtual machines. 

Following parameters can be used:







>


















>
>
>
>
>
>
>
>
>
>
>
>







319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
==================

Configuration file for [vws], which uses standard .ini format.

There are following sections

    [directories]
	[permissions]
    [create options]
    [tools]

Directories section
-------------------

Contain two parameters: **SharedVMs** and **AutostartVMs**. Both are directories where system-wide virtual machines are stored. 

Shared VMs are VMs which are accessible for all members of **kvm** group, but must be started or stopped manually.

Autostart VMs are started automatically on boot of host. 

If you are using more or less sensible disk layout, i.e. create separate partitions for /usr and /var, you probably want to tune this parameters, because you don't want to store your vms in the /var/cache. 

It is recommended to have both these directories on the same partition, so moving VM from autostart to shared and vice versa would not involve physically copying of the files.

**NB** *autostart is planned for version 0.3*

Permissions
-----------

Options of this section controls interaction with unix user names and
groups for shared and authostarted VMs.

* autostart_user - user name of user which should all autostart vms run
run as
* vm_group - group name which should own all shared VMs.
* setgid_vm - boolean, true if setgid attribute should be set on shared
 VM directory

Create options
--------------


This section list default values, used by **vws create** to create new virtual machines. 

Following parameters can be used: