Overview
Comment: | Hard-stop VMs running in snapshot-mode Fixes [a81419cca7] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
973d89a386926f687b6caed5fde845ab |
User & Date: | vitus on 2015-12-22 12:55:48 |
Other Links: | manifest | tags |
Context
2015-12-22
| ||
12:57 | Fix error crawled into previous commit check-in: d3ca2e329c user: vitus tags: trunk | |
12:55 | Hard-stop VMs running in snapshot-mode Fixes [a81419cca7] check-in: 973d89a386 user: vitus tags: trunk | |
08:54 | Implemented restoration of saved VM state upon start. Fixes [04513cf080] check-in: de32d3e822 user: vitus tags: trunk | |
Changes
Modified vws from [45822981f1] to [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 | 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): | | | 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 | sys.exit(1) else: # # # Check if we are running in the snapshot mode # | | < | 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) |
︙ | ︙ |
Modified vws.mkd from [600f91cf10] to [45cecda93e].
︙ | ︙ | |||
16 17 18 19 20 21 22 | **vws save** *name* **vws reset** *name* **vws cdrom** [ **--id** *id* ] [ *iso-image* | **--eject *] | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | **vws save** *name* **vws reset** *name* **vws cdrom** [ **--id** *id* ] [ *iso-image* | **--eject *] **vws usb insert** *name* *pattern* **vws usb remove** *name* *pattern* **vws usb attached** *name* **vws usb list** **vws snapshot** *name* [ *id* ] |
︙ | ︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | 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 interface. You can live without DHCP on bridge, but it would be your problem to configure IP address on each VW manually. If you are planning to deploy many VWs with different operating systems, it is better to have DHCP running. STARTING AND STOPPING --------------------- **vws start** \[ **--cdrom** _iso-image_\] \[**--snapshot**\] \[ --no-gui \] *vw-name* Starts virtual machine. Optionally, connects specified *iso-image* to | > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | 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 interface. You can live without DHCP on bridge, but it would be your problem to configure IP address on each VW manually. If you are planning to deploy many VWs with different operating systems, it is better to have DHCP running. USAGE ===== STARTING AND STOPPING --------------------- **vws start** \[ **--cdrom** _iso-image_\] \[**--snapshot**\] \[ --no-gui \] *vw-name* Starts virtual machine. Optionally, connects specified *iso-image* to |
︙ | ︙ | |||
206 207 208 209 210 211 212 | Lists USB devices which can be attached to virtual machine. **vws usb attached** *machine* Lists USB devices which are currently attached | | | > > | > | > > | > | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 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 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | Lists USB devices which can be attached to virtual machine. **vws usb attached** *machine* Lists USB devices which are currently attached **vws usb insert** *machine* [ *pattern* | **--address** *bus.device* ] Attach given devices to the virtual machine. *pattern* is some regexp which device description output by **vws usb list** should match. Or, optionally you can specify exact address as bus number and device number on this bus. **vws usb remove** *machine* [ *pattern* | **--address** *bus.device* ] Detaches USB device. SNAPSHOTS --------- MISCELLANEA ----------- **vws** allows to take virtual machine screenshot or record sound, produced by virtual machine. One don't need to have GUI window open to take screenshots. **vws screenshot** *machine* *filename.ppm* Makes a screenshot. **vws record** *machine* *filename.wav* Start recording of machine sound output **vws stoprecord** *machine* Stop recording sound. **vws monitor** *machine* Attaches to the machine monitor and allows user to send monitor commands from the keyboard and see output. Uses lockin common to all **vws** command, so you can use other **vws** command in parallel with **monitor** command running. **vws spiceuri** *machine* Prints out URI you should feed into your spice viewer to access this machine. CONFIGURATION FILE ================== 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: * **net=user** or **net=**_inteface name_ - network type by default. Can be either **user** or name of existing brige interface. If you have [set up bridge, you'll probably want to specify name of bridge interface here. * **size=**_virtual disk size* - size of the disk image to create by default. 20G is probably big enough for most modern OS-es and small enough to fit on the modern disks. Note that we use **qcow2** format, so all disk space is not preallocated. You can use G or M suffixes to specify size. * **mem=**_memory size_ - default memory size. Also can have M or G suffix. * **diskif=**_interface_ where _interface_ can be **ide**, **scsi** or **virtio**. Disk interface. **virtio** offer best performance, but only if supported by quest operating system. **ide** offers best compatibilty. Windows vms must be created with ide, although it is possible to convert to virtio after installation. * **arch=**_architecture_ In most cases your choice is limited between **i386** and **x86_64**. Although you probably have qemu binaries for many other architectures, and it is theoretically possible to use them, they would be emulated without hardware acceleration and require some queer QEMU parameters, which are not supported by **vws** now. * **sound=**_list of sound cards) specify which sound cards are emulated in the virtual machine. In most cases **hda** is all you need. But qemu supports long list of sound cards which can be found out by typing: qemu-system-i386 -soundhw help You can specify several of them, separated by comma. * **vga=**_type_ Type of emulated videoadapter **qxl** offers best performance with spice, but have mouse glitches with some old versions of X11. If you encounter such a problem, try to use some other type of videoadapter, listed on the manual page **qemu-system**(1). TOOLS SECTION ------------- Following programs can be specified via this section: * **viewer=** Name of spice client to run. %s in the command line is replaced by spice URI. Default remote-viewer %s * **bridge_list=** command to run to list bridge interfaces. Default brctl show * **lsusb=** command to run to list host USB devices. Default lsusb. LAYOUT OF VIRTUAL MACHINES ========================== Even though virtual machines are completely independent, we need some conventions to simplify tools usage (to avoid specifying full path in the command line) So, we adopt following convention: 1. All files related to each machine are stored in the one directory, named after the machine. See virtual machine directory. 2. There are three types of virtual machine - shared, autostarted and user. shared and autostarted are stored in the some area, described in the global configuration file /etc/vws.conf, user stored in ${HOME}/VWs. Each virtual machine directory contains: 1. startup script, named **start** 2. monitor socket named **monitor** 3. pid file **pid** 4. One or more drive images. Each image can have several backing files (snapshots). All references to the drive images or to backing files within drive images use relative paths, so you can move directory around, and machine would still work. |