Overview
Comment: | Hopefilly fixed problem with hangs of monitor operation. Implemented screenshot, record and stoprecord commands. Incorporated start.template inside script, improved error diagnostic on create |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a090f477b4e09ae01f4a6cace503ce0b |
User & Date: | vitus on 2015-12-12 07:26:35 |
Other Links: | manifest | tags |
Context
2015-12-17
| ||
12:47 | Implented snapshots check-in: d9a66bb196 user: vitus tags: trunk | |
2015-12-12
| ||
07:26 | Hopefilly fixed problem with hangs of monitor operation. Implemented screenshot, record and stoprecord commands. Incorporated start.template inside script, improved error diagnostic on create check-in: a090f477b4 user: vitus tags: trunk | |
2015-12-11
| ||
21:21 | Added stop --hard, written some usb-related code check-in: 2cc90f6c24 user: vitus tags: trunk | |
Changes
Modified vws from [910684f88e] to [0d9abda1a1].
︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | + | answer=send_command(options.sock,"usb_del %s" % address) print answer def cmd_usb_attached(options): for t in get_host_devices(options.sock): print "Address %s : %s"%(t[0],t[1]) print answer def cmd_list(options): count = 0 search_path=[os.environ['HOME']+"/VWs", config.get("directories","SharedVMs"), config.get("directories","AutostartVMs")] for dirname in search_path: if not os.access(dirname+"/.",os.X_OK): |
︙ | |||
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | for f in sorted(vms): if len(f)==2: print "%*s %s" % (-maxlen,f[0],f[1]) else: print f[0] if not count: sys.exit(1) def cmd_screenshot(options): from os.path import abspath filename = abspath(options.filename) print send_command(options.sock,"screendump "+filename) def cmd_record(options): from os.path import abspath filename = abspath(options.filename) print send_command(options.sock,"wavcapture "+filename) def cmd_stoprecord(options): answer = send_command(options.sock,"info capture") m=re.search('\[(\d+)\]: ',answer) if not m: print >>sys.stderr,"No sound recording in progress" else: print send_command(options.sock,"stopcapture "+m.group(1)) def cmd_version(options): print VERSION def validate_size(size): return re.match('\d+[KMG]',size) is not None template="""#!/bin/sh # Get machine name from current directory name NAME=$(basename $(pwd)) # if remote access is enabled, then there should be # SPICE_PASSWORD=password QEMU_AUDIO_DRV=spice export QEMU_AUDIO_DRV if [ -n "$SPICE_PASSWORD" ]; then SPICE_AUTH="password=$SPICE_PASSWORD" else SPICE_AUTH="disable-ticketing,addr=127.0.0.1" fi SPICE_PORT=$(find_free_port 5900) if [ "$1" = '-cdrom' ]; then shift CDROM=",file=$1" shift fi {qemubinary} -name $NAME {accel} \\ -m {memory} \\ {drive} \\ {cdrom}$CDROM \\ {net} \\ {usb} \\ {sound} \\ -chardev socket,server,nowait,path=monitor,id=monitor \\ -mon chardev=monitor,mode=readline \\ -vga {vga} \\ -spice port=$SPICE_PORT,$SPICE_AUTH \\ -device virtio-serial -chardev spicevmc,id=vdagent,name=vdagent \\ -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \\ -device ich9-usb-ehci1,id=usb \\ -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,multifunction=on \\ -chardev spicevmc,name=usbredir,id=usbredirchardev1 \\ -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1 \\ -daemonize -pidfile pid """ def cmd_create(parsed_args): import os.path global template if not parsed_args.image and not validate_size(parsed_args.size): print >>sys.stderr,"Invalid size of disk specifed %s. Should have K, M or G suffix"%parsed_args.size sys.exit(1) if not validate_size(parsed_args.mem): print >>sys.stderr,"Invalid size of memory specifed %s. Should have K, M or G suffix"%parsed_args.size sys.exit(1) libdir="/usr/local/lib/vws" |
︙ | |||
268 269 270 271 272 273 274 | 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 364 365 | - + + + + + + - - | if not parsed_args.sound: options["sound"]='' else: options["sound"]='-soundhw '+parsed_args.sound options["memory"]=parsed_args.mem |
︙ | |||
317 318 319 320 321 322 323 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - + | return p # # arg parsing # |
︙ | |||
366 367 368 369 370 371 372 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | + - + + - - + + | p=new_command(usb,'remove',help='detach connected usb device') p.add_argument('pattern',help='Pattern of device name to look up in lsusb') p.add_argument('--address',type=str,dest='address',nargs=1,help='exact address bus:device') p=new_command(usb,'attached',help='list devices attached to vm') usb.add_parser('list',help='list devices available in the host system') # Snapshot management p=new_command(cmds,'snapshot',help='Create new snapshot') p.add_argument('snapname',help='snapshot name') |
︙ | |||
422 423 424 425 426 427 428 | 488 489 490 491 492 493 494 495 496 497 | + + + | funcname+="_"+parsed_args.subcommand try: func=globals()[funcname] except KeyError: print >>sys.stderr,"Operation %s is not implemented"%funcname sys.exit(3) func(parsed_args) if hasattr(parsed_args,'sock') and parsed_args.sock is not None: parsed_args.sock.close() |