1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
$NetBSD: patch-dj,v 1.1 2008/03/03 16:45:27 hannken Exp $
--- python/xen/xend/XendBootloader.py.orig 2008-01-31 11:06:54.000000000 +0100
+++ python/xen/xend/XendBootloader.py 2008-03-02 13:37:58.000000000 +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,8 @@ 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 +108,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:
|