--- Begin Message ---
Package: guml
Severity: wishlist
A few random improvements to the GUML sources, from Antoine Nguyen.
- Matt
----- Forwarded message from Antoine Nguyen <tonio@ngyn.org> -----
Date: Fri, 10 Aug 2007 09:09:55 +0200
From: Antoine Nguyen <tonio@ngyn.org>
To: Matthew Palmer <mpalmer@hezmatt.org>
Subject: Re: GUML little patch
Matthew Palmer wrote:
>On Thu, Aug 09, 2007 at 11:55:30AM +0200, Antoine Nguyen wrote:
>
>>I've added some missing features to your soft (mainly in configuration
>>part, ie support for tuntap interfaces and different uml binary).
>>I've also changed the default font used for vte (fixed 12), it better
>>fits the window... in my opinion ^^
>>
>>I've worked on the 0.3 tarball.
>>
>>How can I submit you my modifications? What do you prefer?
>>
>
>A unified diff between my release and your tree is best, as it's pretty easy
>for me to see what's been changed. E-mail to me is probably easiest.
>
>
You will find my modifications in the attached patch (unified format).
>>PS: I've noticed that your last version was in 2005, do you still work
>>on the project?
>>
>
>Not really. Fairly soon after I released 0.3, I started using Xen at work
>and I never got around to patching my workstation's kernel for UML when I
>last upgraded mid last year, so I haven't used UML in quite some time. If
>you're interested in taking over maintenance and development of GUML, I'd be
>happy for you to do so.
>
>- Matt
>
>
Thanks for your proposal. I just begin to work with UML (I'm a kernel
developer for a french company, UML and gdb help me a lot ^^). If I get
some time in next weeks, I'll try to add extra features into GUML.
Antoine
diff -ur guml-0.3/guml.py guml-0.3.my/guml.py
--- guml-0.3/guml.py 2005-10-05 06:25:56.000000000 +0200
+++ guml-0.3.my/guml.py 2007-08-06 10:39:24.000000000 +0200
@@ -60,7 +60,7 @@
winbox.pack_start(mainbox, expand=False)
- self.window = gtk.Window()
+ self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_border_width(10)
self.window.add(winbox)
self.window.connect('destroy', self.shutdown)
diff -ur guml-0.3/uml.py guml-0.3.my/uml.py
--- guml-0.3/uml.py 2005-10-05 06:25:56.000000000 +0200
+++ guml-0.3.my/uml.py 2007-08-09 11:42:27.000000000 +0200
@@ -58,7 +58,6 @@
self.running = True
self.console = console(self.config.command_line())
self.console.connect('destroy', self.controller_dead)
-
self.do_the_gui()
def finished(self):
@@ -138,7 +137,7 @@
def make_terminal(self):
self.terminal = vte.Terminal()
self.terminal.set_emulation("xterm")
- self.terminal.set_font_from_string("Mono 8")
+ self.terminal.set_font_from_string("fixed 12")
self.terminal.set_scrollback_lines(300)
self.terminal.set_backspace_binding('ascii-backspace')
self.terminal.set_size(80, 25)
@@ -241,6 +240,12 @@
cfg = self.readconfig(umid)
+ def getItem(self, conf, name, default):
+ try:
+ return conf[name]
+ except KeyError:
+ return default
+
def readconfig(self, umid):
confdata = SafeConfigParser()
confdata.read("%s/.guml/%s.conf" % (os.getenv("HOME"), umid))
@@ -268,30 +273,18 @@
print "Fatal: failed to find a name for %s" % self.umid
sys.exit(2)
- try:
- self.mem = conf['mem']
- except KeyError:
- self.mem = 32
-
- try:
- self.image = conf['image']
- except KeyError:
- self.image = ''
-
- try:
- self.extraopts = conf['extraopts']
- except KeyError:
- self.extraopts = ''
+ self.mem = self.getItem(conf, 'mem', 32)
+ self.image = self.getItem(conf, 'image', '')
+ self.extraopts = self.getItem(conf, 'extraopts', '')
+ self.linux = self.getItem(conf, 'linux', '/usr/bin/linux')
def setnetworkoptions(self, devname, conf):
data = { 'type': conf['type'],
'mac': conf['mac'] }
-
- try:
- data['socket'] = conf['socket']
- except KeyError:
- data['socket'] = '/var/run/uml-utilities/uml_switch.ctl'
-
+
+ data['socket'] = self.getItem(conf, 'socket', '/var/run/uml-utilities/uml_switch.ctl')
+ data['hostdev'] = self.getItem(conf, 'hostdev', '')
+ data['hostaddr'] = self.getItem(conf, 'hostaddr', '')
self.networks[devname] = data
def setdiskoptions(self, conf):
@@ -300,12 +293,18 @@
self.disks[k] = conf[k]
def command_line(self):
- return ["/usr/bin/linux",
+ return ["%s" % self.linux,
"mem=%sM" % self.mem,
"con=pts",
"con0=fd:0,fd:1",
"umid=%s" % self.umid] + self.networkcmdline() + self.blockdevscmdline() + [ self.extraopts ]
+ def if_daemon(self, dev, config):
+ return "%s=daemon,%s,unix,%s" % (dev, config["mac"], config["socket"])
+
+ def if_tuntap(self, dev, config):
+ return "%s=tuntap,,%s,%s" % (dev, config["mac"], config["hostaddr"])
+
def networkcmdline(self):
cmdline = []
@@ -318,7 +317,12 @@
hash = idhash.hexdigest()
cfg['mac'] = 'fe:fd:%s:%s:%s:%s' % (hash[0:2], hash[2:4], hash[4:6], hash[6:8])
- cmdline.append("%s=%s,%s,,%s" % (dev, cfg['type'], cfg['mac'], cfg['socket']))
+ try:
+ func = getattr(self, "if_%s" % cfg['type'])
+ except AttributeError:
+ print "Skipping %s (unknown type)" % dev
+ else:
+ cmdline.append(func(dev, cfg))
return cmdline
----- End forwarded message -----
--- End Message ---