Changeset 35885 in vbox for trunk/src/VBox/Frontends/VBoxShell
- Timestamp:
- Feb 8, 2011 1:20:04 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r35783 r35885 3103 3103 return 3104 3104 3105 def parsePci(str): 3106 pcire = re.compile(r'(?P<b>\d+):(?P<d>\d+)\.(?P<f>\d)') 3107 m = pcire.search(str) 3108 if m is None: 3109 return -1 3110 dict = m.groupdict() 3111 return ((int(dict['b'])) << 8) | ((int(dict['d'])) << 3) | int(dict['f']) 3105 3112 3106 3113 def lspciCmd(ctx, args): … … 3112 3119 return 0 3113 3120 cmdExistingVm(ctx, mach, 'guestlambda', [lambda ctx,mach,console,args: lspci(ctx, console)]) 3121 return 0 3122 3123 def attachpciCmd(ctx, args): 3124 if (len(args) < 3): 3125 print "usage: attachpci vm hostpci <guestpci>" 3126 return 0 3127 mach = argsToMach(ctx,args) 3128 if mach == None: 3129 return 0 3130 hostaddr = parsePci(args[2]) 3131 if hostaddr == -1: 3132 print "invalid host PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" %(args[2]) 3133 return 0 3134 3135 if (len(args) > 3): 3136 guestaddr = parsePci(args[3]) 3137 if guestaddr == -1: 3138 print "invalid guest PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" %(args[3]) 3139 return 0 3140 else: 3141 guestaddr = hostaddr 3142 cmdClosedVm(ctx, mach, lambda ctx,mach,a: mach.attachHostPciDevice(hostaddr, guestaddr, True)) 3143 return 0 3144 3145 def detachpciCmd(ctx, args): 3146 if (len(args) < 3): 3147 print "usage: detachpci vm hostpci" 3148 return 0 3149 mach = argsToMach(ctx,args) 3150 if mach == None: 3151 return 0 3152 hostaddr = parsePci(args[2]) 3153 if hostaddr == -1: 3154 print "invalid host PCI %s, accepted format 01:02.3 for bus 1, device 2, function 3" %(args[2]) 3155 return 0 3156 3157 cmdClosedVm(ctx, mach, 'guestlambda', lambda ctx,mach,a: mach.detachHostPciDevice(hostaddr)) 3114 3158 return 0 3115 3159 … … 3200 3244 'recordDemo':['Record demo: recordDemo Win32 file.dmo 10', recordDemoCmd, 0], 3201 3245 'playbackDemo':['Playback demo: playbackDemo Win32 file.dmo 10', playbackDemoCmd, 0], 3202 'lspci': ['List PCI devices attached to the VM: lspci Win32', lspciCmd] 3246 'lspci': ['List PCI devices attached to the VM: lspci Win32', lspciCmd, 0], 3247 'attachpci': ['Attach host PCI device to the VM: attachpci Win32 01:00.0', attachpciCmd, 0], 3248 'detachpci': ['Detach host PCI device from the VM: detachpci Win32 01:00.0', detachpciCmd, 0] 3203 3249 } 3204 3250
Note:
See TracChangeset
for help on using the changeset viewer.