VirtualBox

Ignore:
Timestamp:
Jan 14, 2011 2:28:53 PM (14 years ago)
Author:
vboxsync
Message:

BnoxShell: update for new medium API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxShell/vboxshell.py

    r35342 r35569  
    21732173   loc = args[2]
    21742174   try:
    2175       hdd = vb.findHardDisk(loc)
     2175      hdd = vb.findMedium(loc, ctx['global'].constants.DeviceType_HardDisk)
    21762176   except:
    21772177      print "no HDD with path %s registered" %(loc)
     
    21952195
    21962196def detachMedium(ctx,mid,medium):
    2197     cmdClosedVm(ctx, mach, detachVmDevice, [medium.id])
     2197    cmdClosedVm(ctx, machById(ctx, mid), detachVmDevice, [medium])
    21982198
    21992199def detachHddCmd(ctx,args):
     
    22082208   loc = args[2]
    22092209   try:
    2210       hdd = vb.findHardDisk(loc)
     2210      hdd = vb.findMedium(loc, ctx['global'].constants.DeviceType_HardDisk)
    22112211   except:
    22122212      print "no HDD with path %s registered" %(loc)
    22132213      return 0
    22142214
    2215    detachMedium(ctx,mach.id,hdd)
     2215   detachMedium(ctx, mach.id, hdd)
    22162216   return 0
    22172217
     
    22282228      vmunreg = 0
    22292229   try:
    2230       hdd = vb.findHardDisk(loc)
     2230      hdd = vb.findMedium(loc, ctx['global'].constants.DeviceType_HardDisk)
    22312231   except:
    22322232      print "no HDD with path %s registered" %(loc)
     
    22382238         for m in machs:
    22392239            print "Trying to detach from %s" %(m)
    2240             detachMedium(ctx,m,hdd)
     2240            detachMedium(ctx, m, hdd)
    22412241      except Exception, e:
    22422242         print 'failed: ',e
     
    22532253   loc = args[1]
    22542254   try:
    2255       hdd = vb.findHardDisk(loc)
     2255      hdd = vb.findMedium(loc, ctx['global'].constants.DeviceType_HardDisk)
    22562256   except:
    22572257      print "no HDD with path %s registered" %(loc)
     
    22822282   loc = args[1]
    22832283   try:
    2284       dvd = vb.findDVDImage(loc)
     2284      dvd = vb.findMedium(loc, )
    22852285   except:
    22862286      print "no DVD with path %s registered" %(loc)
     
    23002300   loc = args[1]
    23012301   try:
    2302       dvd = vb.findDVDImage(loc)
     2302      dvd = vb.findMedium(loc, ctx['global'].constants.DeviceType_DVD)
    23032303   except:
    23042304      print "no DVD with path %s registered" %(loc)
     
    23232323   loc = args[2]
    23242324   try:
    2325       dvd = vb.findDVDImage(loc)
     2325      dvd = vb.findMedium(loc, ctx['global'].constants.DeviceType_DVD)
    23262326   except:
    23272327      print "no DVD with path %s registered" %(loc)
     
    23322332   else:
    23332333       [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
    2334    cmdClosedVm(ctx, mach, lambda ctx,mach,args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_DVD,dvd.id))
     2334   cmdClosedVm(ctx, mach, lambda ctx,mach,args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_DVD, dvd))
    23352335   return 0
    23362336
     
    23462346   loc = args[2]
    23472347   try:
    2348       dvd = vb.findDVDImage(loc)
     2348      dvd = vb.findMedium(loc, ctx['global'].constants.DeviceType_DVD)
    23492349   except:
    23502350      print "no DVD with path %s registered" %(loc)
    23512351      return 0
    23522352
    2353    detachMedium(ctx,mach.id,dvd)
     2353   detachMedium(ctx, mach.id, dvd)
    23542354   return 0
    23552355
     
    23652365   loc = args[2]
    23662366   try:
    2367       dvd = vb.findDVDImage(loc)
     2367      dvd = vb.findMedium(loc, ctx['global'].constants.DeviceType_DVD)
    23682368   except:
    23692369      print "no DVD with path %s registered" %(loc)
     
    23772377       [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
    23782378
    2379    cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, dvd.id, True])
     2379   cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, dvd, True])
    23802380
    23812381   return 0
     
    23912391   vb = ctx['vb']
    23922392
    2393    if len(args) > 2:
     2393   if len(args) > 3:
    23942394       ctr = args[2]
    23952395       (port,slot) = args[3].split(":")
     
    23982398       [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD)
    23992399
    2400    cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, "", True])
     2400   cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, None, True])
    24012401
    24022402   return 0
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette