All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][TOOLS] pygrub: cleanup and support for NetBSD
@ 2008-03-26 14:16 Christoph Egger
  2008-03-28  7:26 ` INAKOSHI Hiroya
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Egger @ 2008-03-26 14:16 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]


Hi Keir,

Attached patch gets rid of the global attr variable and adds support for 
NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: tools_pygrub.diff --]
[-- Type: text/x-diff, Size: 3190 bytes --]

diff -r 966c04d42e94 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Wed Mar 26 09:12:57 2008 +0000
+++ b/tools/pygrub/src/pygrub	Wed Mar 26 16:33:01 2008 +0100
@@ -240,10 +240,10 @@ class Grub:
             if y > self.start_image + maxy:
                 break
             if y == self.selected_image:
-                attr = curses.A_REVERSE
-            else:
-                attr = 0
-            self.entry_win.addstr(y + 1 - self.start_image, 2, i.title.ljust(70), attr)
+                self.entry_win.attron(curses.A_REVERSE)
+            self.entry_win.addstr(y + 1 - self.start_image, 2, i.title.ljust(70))
+            if y == self.selected_image:
+                self.entry_win.attroff(curses.A_REVERSE)
         self.entry_win.refresh()
 
     def edit_entry(self, origimg):
@@ -269,16 +269,17 @@ class Grub:
             self.entry_win.box()
             for idx in range(1, len(img.lines)):
                 # current line should be highlighted
-                attr = 0
                 if idx == curline:
-                    attr = curses.A_REVERSE
+                    self.entry_win.attron(curses.A_REVERSE)
 
                 # trim the line
                 l = img.lines[idx].ljust(70)
                 if len(l) > 70:
                     l = l[:69] + ">"
                     
-                self.entry_win.addstr(idx, 2, l, attr)
+                self.entry_win.addstr(idx, 2, l)
+                if idx == curline:
+                    self.entry_win.attroff(curses.A_REVERSE)
             self.entry_win.refresh()
 
             c = self.screen.getch()
diff -r 966c04d42e94 tools/python/xen/xend/XendBootloader.py
--- a/tools/python/xen/xend/XendBootloader.py	Wed Mar 26 09:12:57 2008 +0000
+++ b/tools/python/xen/xend/XendBootloader.py	Wed Mar 26 16:33:01 2008 +0100
@@ -12,7 +12,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
-import os, select, errno, stat, signal
+import os, select, errno, stat, signal, tty
 import random
 import shlex
 from xen.xend import sxp
@@ -43,6 +43,9 @@ def bootloader(blexec, disk, dom, quiet 
         log.error(msg)
         raise VmError(msg)
 
+    if os.uname()[0] == "NetBSD" and disk.startswith('/dev/'):
+       disk = disk.replace("/dev/", "/dev/r")
+
     mkdir.parents("/var/run/xend/boot/", stat.S_IRWXU)
 
     while True:
@@ -63,12 +66,9 @@ def bootloader(blexec, disk, dom, quiet 
     # where we copy characters between the two master fds, as well as
     # listening on the bootloader's fifo for the results.
 
-    # Termios runes for very raw access to the pty master fds.
-    attr = [ 0, 0, termios.CS8 | termios.CREAD | termios.CLOCAL,
-             0, 0, 0, [0] * 32 ]
-
     (m1, s1) = pty.openpty()
     termios.tcsetattr(m1, termios.TCSANOW, attr)
+    tty.setraw(m1);
     fcntl.fcntl(m1, fcntl.F_SETFL, os.O_NDELAY);
     os.close(s1)
     slavename = ptsname.ptsname(m1)
@@ -109,7 +109,7 @@ def bootloader(blexec, disk, dom, quiet 
     # record that this domain is bootloading
     dom.bootloader_pid = child
 
-    termios.tcsetattr(m2, termios.TCSANOW, attr)
+    tty.setraw(m2);
     fcntl.fcntl(m2, fcntl.F_SETFL, os.O_NDELAY);
     while True:
         try:

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][TOOLS] pygrub: cleanup and support for NetBSD
  2008-03-26 14:16 [PATCH][TOOLS] pygrub: cleanup and support for NetBSD Christoph Egger
@ 2008-03-28  7:26 ` INAKOSHI Hiroya
  2008-03-28  7:35   ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: INAKOSHI Hiroya @ 2008-03-28  7:26 UTC (permalink / raw)
  To: Christoph Egger; +Cc: xen-devel

Hi Christoph,

your patch made my linux guest unbootable.  Here is the xend.log.

Regards,
Hiroya

2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:2279)
XendDomainInfo.destroy: domid=1
[2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:2296)
XendDomainInfo.destroyDomain(1)
[2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:1857) No device model
[2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:1859) Releasing devices
[2008-03-28 16:11:07 4582] ERROR (SrvBase:88) Request start failed.
Traceback (most recent call last):
  File "//usr/lib/python/xen/web/SrvBase.py", line 85, in perform
    return op_method(op, req)
  File "//usr/lib/python/xen/xend/server/SrvDomain.py", line 77, in op_start
    return self.xd.domain_start(self.dom.getName(), paused)
  File "//usr/lib/python/xen/xend/XendDomain.py", line 1030, in domain_start
    dominfo.start(is_managed = True)
  File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 420, in start
    XendTask.log_progress(31, 60, self._initDomain)
  File "//usr/lib/python/xen/xend/XendTask.py", line 209, in log_progress
    retval = func(*args, **kwds)
  File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 2046, in
_initDomain
    self._configureBootloader()
  File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 2446, in
_configureBootloader
    bootloader_args, kernel, ramdisk, args)
  File "//usr/lib/python/xen/xend/XendBootloader.py", line 70, in bootloader
    termios.tcsetattr(m1, termios.TCSANOW, attr)
NameError: global name 'attr' is not defined


Christoph Egger wrote:
> Hi Keir,
> 
> Attached patch gets rid of the global attr variable and adds support for 
> NetBSD.
> 
> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][TOOLS] pygrub: cleanup and support for NetBSD
  2008-03-28  7:26 ` INAKOSHI Hiroya
@ 2008-03-28  7:35   ` Keir Fraser
  2008-03-28  9:34     ` Christoph Egger
  0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2008-03-28  7:35 UTC (permalink / raw)
  To: INAKOSHI Hiroya, Christoph Egger; +Cc: xen-devel

Fixed as changeset 17314.

 -- Keir

On 28/3/08 07:26, "INAKOSHI Hiroya" <inakoshi.hiroya@jp.fujitsu.com> wrote:

> Hi Christoph,
> 
> your patch made my linux guest unbootable.  Here is the xend.log.
> 
> Regards,
> Hiroya
> 
> 2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:2279)
> XendDomainInfo.destroy: domid=1
> [2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:2296)
> XendDomainInfo.destroyDomain(1)
> [2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:1857) No device model
> [2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:1859) Releasing devices
> [2008-03-28 16:11:07 4582] ERROR (SrvBase:88) Request start failed.
> Traceback (most recent call last):
>   File "//usr/lib/python/xen/web/SrvBase.py", line 85, in perform
>     return op_method(op, req)
>   File "//usr/lib/python/xen/xend/server/SrvDomain.py", line 77, in op_start
>     return self.xd.domain_start(self.dom.getName(), paused)
>   File "//usr/lib/python/xen/xend/XendDomain.py", line 1030, in domain_start
>     dominfo.start(is_managed = True)
>   File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 420, in start
>     XendTask.log_progress(31, 60, self._initDomain)
>   File "//usr/lib/python/xen/xend/XendTask.py", line 209, in log_progress
>     retval = func(*args, **kwds)
>   File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 2046, in
> _initDomain
>     self._configureBootloader()
>   File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 2446, in
> _configureBootloader
>     bootloader_args, kernel, ramdisk, args)
>   File "//usr/lib/python/xen/xend/XendBootloader.py", line 70, in bootloader
>     termios.tcsetattr(m1, termios.TCSANOW, attr)
> NameError: global name 'attr' is not defined
> 
> 
> Christoph Egger wrote:
>> Hi Keir,
>> 
>> Attached patch gets rid of the global attr variable and adds support for
>> NetBSD.
>> 
>> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
>> 
>> 
>> ------------------------------------------------------------------------
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][TOOLS] pygrub: cleanup and support for NetBSD
  2008-03-28  7:35   ` Keir Fraser
@ 2008-03-28  9:34     ` Christoph Egger
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Egger @ 2008-03-28  9:34 UTC (permalink / raw)
  To: Keir Fraser; +Cc: INAKOSHI Hiroya, xen-devel

On Friday 28 March 2008 08:35:33 Keir Fraser wrote:
> Fixed as changeset 17314.

I can confirm this fix is correct. I don't know how this could slip through 
when I submitted the patch. Sorry for that.

Christoph

>
>  -- Keir
>
> On 28/3/08 07:26, "INAKOSHI Hiroya" <inakoshi.hiroya@jp.fujitsu.com> wrote:
> > Hi Christoph,
> >
> > your patch made my linux guest unbootable.  Here is the xend.log.
> >
> > Regards,
> > Hiroya
> >
> > 2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:2279)
> > XendDomainInfo.destroy: domid=1
> > [2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:2296)
> > XendDomainInfo.destroyDomain(1)
> > [2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:1857) No device model
> > [2008-03-28 16:11:07 4582] DEBUG (XendDomainInfo:1859) Releasing devices
> > [2008-03-28 16:11:07 4582] ERROR (SrvBase:88) Request start failed.
> > Traceback (most recent call last):
> >   File "//usr/lib/python/xen/web/SrvBase.py", line 85, in perform
> >     return op_method(op, req)
> >   File "//usr/lib/python/xen/xend/server/SrvDomain.py", line 77, in
> > op_start return self.xd.domain_start(self.dom.getName(), paused)
> >   File "//usr/lib/python/xen/xend/XendDomain.py", line 1030, in
> > domain_start dominfo.start(is_managed = True)
> >   File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 420, in start
> >     XendTask.log_progress(31, 60, self._initDomain)
> >   File "//usr/lib/python/xen/xend/XendTask.py", line 209, in log_progress
> >     retval = func(*args, **kwds)
> >   File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 2046, in
> > _initDomain
> >     self._configureBootloader()
> >   File "//usr/lib/python/xen/xend/XendDomainInfo.py", line 2446, in
> > _configureBootloader
> >     bootloader_args, kernel, ramdisk, args)
> >   File "//usr/lib/python/xen/xend/XendBootloader.py", line 70, in
> > bootloader termios.tcsetattr(m1, termios.TCSANOW, attr)
> > NameError: global name 'attr' is not defined
> >
> > Christoph Egger wrote:
> >> Hi Keir,
> >>
> >> Attached patch gets rid of the global attr variable and adds support for
> >> NetBSD.
> >>
> >> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
> >>
> >>
> >> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Xen-devel mailing list
> >> Xen-devel@lists.xensource.com
> >> http://lists.xensource.com/xen-devel
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel



-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-03-28  9:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-26 14:16 [PATCH][TOOLS] pygrub: cleanup and support for NetBSD Christoph Egger
2008-03-28  7:26 ` INAKOSHI Hiroya
2008-03-28  7:35   ` Keir Fraser
2008-03-28  9:34     ` Christoph Egger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.