Changeset 28650 in vbox for trunk/src/VBox/Frontends/VBoxShell
- Timestamp:
- Apr 23, 2010 2:15:14 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60510
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r28637 r28650 234 234 235 235 def reportError(ctx,progress): 236 print progress.errorInfo 236 ei = progress.errorInfo 237 if ei: 238 print "Error in %s: %s" %(ei.component, ei.text) 237 239 238 240 def createVm(ctx,name,kind,base): … … 745 747 passwd = "" 746 748 tmo = 0 747 print "executing %s with %s" %(args[0], args[1:]) 748 (progress, pid) = console.guest.executeProcess(args[0], 0, args[1:], [], "", "", "", user, passwd, tmo) 749 if progressBar(ctx,progress, 10): 750 print "executed with pid %d" %(pid) 749 guest = console.guest 750 print "executing %s with args %s" %(args[0], args[1:]) 751 (progress, pid) = guest.executeProcess(args[0], 0, args[1:], [], "", "", "", user, passwd, tmo) 752 print "executed with pid %d" %(pid) 753 if pid != 0: 754 while not progress.completed: 755 data = guest.getProcessOutput(pid, 0, 1, 4096) 756 if data and len(data) > 0: 757 sys.stdout.write(data) 758 progress.waitForCompletion(100) 759 ctx['global'].waitForEvents(0) 751 760 else: 752 761 reportError(ctx, progress) … … 763 772 cmdExistingVm(ctx, mach, 'guestlambda', gargs) 764 773 return 0 774 775 def gcatCmd(ctx,args): 776 if (len(args) < 2): 777 print "usage: gcat [vmname|uuid] local_file | guestProgram, such as gcat linux /home/nike/.bashrc | sh -c 'cat >'" 778 return 0 779 mach = argsToMach(ctx,args) 780 if mach == None: 781 return 0 782 gargs = args[2:] 783 gargs.insert(0, lambda ctx,mach,console,args: execInGuest(ctx,console,args)) 784 cmdExistingVm(ctx, mach, 'guestlambda', gargs) 785 return 0 786 765 787 766 788 def removeVmCmd(ctx, args): … … 1541 1563 return 0 1542 1564 1565 1566 def findDevOfType(ctx,mach,type): 1567 atts = ctx['global'].getArray(mach, 'mediumAttachments') 1568 for a in atts: 1569 if a.type == type: 1570 return [a.controller, a.port, a.device] 1571 return [None, 0, 0] 1572 1543 1573 def createHddCmd(ctx,args): 1544 1574 if (len(args) < 3): … … 1584 1614 1585 1615 def attachHddCmd(ctx,args): 1586 if (len(args) < 4):1616 if (len(args) < 3): 1587 1617 print "usage: attachHdd vm hdd controller port:slot" 1588 1618 return 0 … … 1598 1628 print "no HDD with path %s registered" %(loc) 1599 1629 return 0 1600 ctr = args[3] 1601 (port,slot) = args[4].split(":") 1630 if len(args) > 3: 1631 ctr = args[3] 1632 (port,slot) = args[4].split(":") 1633 else: 1634 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_HardDisk) 1635 1602 1636 cmdClosedVm(ctx, mach, lambda ctx,mach,args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_HardDisk,hdd.id)) 1603 1637 return 0 … … 1730 1764 1731 1765 def attachIsoCmd(ctx,args): 1732 if (len(args) < 5):1766 if (len(args) < 3): 1733 1767 print "usage: attachIso vm iso controller port:slot" 1734 1768 return 0 … … 1744 1778 print "no DVD with path %s registered" %(loc) 1745 1779 return 0 1746 ctr = args[3] 1747 (port,slot) = args[4].split(":") 1780 if len(args) > 3: 1781 ctr = args[3] 1782 (port,slot) = args[4].split(":") 1783 else: 1784 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD) 1748 1785 cmdClosedVm(ctx, mach, lambda ctx,mach,args: mach.attachDevice(ctr, port, slot, ctx['global'].constants.DeviceType_DVD,dvd.id)) 1749 1786 return 0 … … 1769 1806 1770 1807 def mountIsoCmd(ctx,args): 1771 if (len(args) < 5):1808 if (len(args) < 3): 1772 1809 print "usage: mountIso vm iso controller port:slot" 1773 1810 return 0 … … 1784 1821 return 0 1785 1822 1786 ctr = args[3] 1787 (port,slot) = args[4].split(":") 1823 if len(args) > 3: 1824 ctr = args[3] 1825 (port,slot) = args[4].split(":") 1826 else: 1827 # autodetect controller and location, just find first controller with media == DVD 1828 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD) 1788 1829 1789 1830 cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, dvd.id, True]) … … 1792 1833 1793 1834 def unmountIsoCmd(ctx,args): 1794 if (len(args) < 4):1835 if (len(args) < 2): 1795 1836 print "usage: unmountIso vm controller port:slot" 1796 1837 return 0 … … 1801 1842 vb = ctx['vb'] 1802 1843 1803 ctr = args[2] 1804 (port,slot) = args[3].split(":") 1844 if len(args) > 2: 1845 ctr = args[2] 1846 (port,slot) = args[3].split(":") 1847 else: 1848 # autodetect controller and location, just find first controller with media == DVD 1849 [ctr, port, slot] = findDevOfType(ctx, mach, ctx['global'].constants.DeviceType_DVD) 1805 1850 1806 1851 cmdExistingVm(ctx, mach, 'mountiso', [ctr, port, slot, "", True])
Note:
See TracChangeset
for help on using the changeset viewer.