[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/9] tools: move xm and xend under tools python



Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/misc/Makefile        |    2 +-
 tools/misc/xend            |  110 --------------------------------------------
 tools/misc/xm              |    7 ---
 tools/python/Makefile      |    4 ++
 tools/python/xen/xend/xend |  110 ++++++++++++++++++++++++++++++++++++++++++++
 tools/python/xen/xm/xm     |    7 +++
 6 files changed, 122 insertions(+), 118 deletions(-)
 delete mode 100644 tools/misc/xend
 delete mode 100755 tools/misc/xm
 create mode 100644 tools/python/xen/xend/xend
 create mode 100755 tools/python/xen/xm/xm

diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 520ef80..73b55dd 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -22,7 +22,7 @@ INSTALL_BIN-y := xencons xencov_split
 INSTALL_BIN-$(CONFIG_X86) += xen-detect
 INSTALL_BIN := $(INSTALL_BIN-y)
 
-INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm 
xen-tmem-list-parse gtraceview \
+INSTALL_SBIN-y := xen-bugtool xen-python-path xenperf xsview xenpm 
xen-tmem-list-parse gtraceview \
        gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov
 INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd
 INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
diff --git a/tools/misc/xend b/tools/misc/xend
deleted file mode 100644
index 9ef0210..0000000
--- a/tools/misc/xend
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env python
-#  -*- mode: python; -*-
-#============================================================================
-# Copyright (C) 2004 Mike Wray <mike.wray@xxxxxx>
-# Copyright (C) 2005-2006 XenSource Inc
-#============================================================================
-
-"""Xen management daemon.
-   Provides console server and HTTP management api.
-
-   Run:
-   xend start
-
-   Restart:
-   xend restart
-
-   The daemon is stopped with:
-   xend stop
-
-   The daemon should reconnect to device control interfaces
-   and recover its state when restarted.
-
-   On Solaris, the daemons are SMF managed, and you should not attempt
-   to start xend by hand.
-"""
-import fcntl
-import glob
-import os
-import os.path
-import sys
-import socket
-import signal
-import time
-import commands
-
-from xen.xend.server import SrvDaemon
-
-class CheckError(ValueError):
-    pass
-
-def hline():
-    print >>sys.stderr, "*" * 70
-
-def msg(message):
-    print >>sys.stderr, "*" * 3, message
-
-def check_logging():
-    """Check python logging is installed and raise an error if not.
-    Logging is standard from Python 2.3 on.
-    """
-    try:
-        import logging
-    except ImportError:
-        hline()
-        msg("Python logging is not installed.")
-        msg("Use 'make install-logging' at the xen root to install.")
-        msg("")
-        msg("Alternatively download and install from")
-        msg("http://www.red-dove.com/python_logging.html";)
-        hline()
-        raise CheckError("logging is not installed")
-
-def check_user():
-    """Check that the effective user id is 0 (root).
-    """
-    if os.geteuid() != 0:
-        hline()
-        msg("Xend must be run as root.")
-        hline()
-        raise CheckError("invalid user")
-
-def start_daemon(daemon, *args):
-    if os.fork() == 0:
-        os.execvp(daemon, (daemon,) + args)
-
-def start_blktapctrl():
-    start_daemon("blktapctrl", "")
-
-def main():
-    try:
-        check_logging()
-        check_user()
-    except CheckError:
-        sys.exit(1)
-    
-    daemon = SrvDaemon.instance()
-    if not sys.argv[1:]:
-        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0]
-    elif sys.argv[1] == 'start':
-        if os.uname()[0] != "SunOS":
-            start_blktapctrl()
-        return daemon.start()
-    elif sys.argv[1] == 'trace_start':
-        start_blktapctrl()
-        return daemon.start(trace=1)
-    elif sys.argv[1] == 'stop':
-        return daemon.stop()
-    elif sys.argv[1] == 'reload':
-        return daemon.reloadConfig()
-    elif sys.argv[1] == 'restart':
-        start_blktapctrl()
-        return daemon.stop() or daemon.start()
-    elif sys.argv[1] == 'status':
-        return daemon.status()
-    else:
-        print 'not an option:', sys.argv[1]
-    return 1
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/tools/misc/xm b/tools/misc/xm
deleted file mode 100755
index f4fd200..0000000
--- a/tools/misc/xm
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-#  -*- mode: python; -*-
-import sys
-
-from xen.xm import main
-
-main.main(sys.argv)
diff --git a/tools/python/Makefile b/tools/python/Makefile
index 9be1122..8461d0f 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -23,6 +23,10 @@ install: install-dtd
        CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \
                $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
 
+       $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
+       $(INSTALL_PYTHON_PROG) xen/xm/xm $(DESTDIR)$(SBINDIR)/xm
+       $(INSTALL_PYTHON_PROG) xen/xend/xend $(DESTDIR)$(SBINDIR)/xend
+
 install-dtd: all
        $(INSTALL_DIR) $(DESTDIR)$(SHAREDIR)/xen
        $(INSTALL_DATA) xen/xm/create.dtd $(DESTDIR)$(SHAREDIR)/xen
diff --git a/tools/python/xen/xend/xend b/tools/python/xen/xend/xend
new file mode 100644
index 0000000..9ef0210
--- /dev/null
+++ b/tools/python/xen/xend/xend
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+#  -*- mode: python; -*-
+#============================================================================
+# Copyright (C) 2004 Mike Wray <mike.wray@xxxxxx>
+# Copyright (C) 2005-2006 XenSource Inc
+#============================================================================
+
+"""Xen management daemon.
+   Provides console server and HTTP management api.
+
+   Run:
+   xend start
+
+   Restart:
+   xend restart
+
+   The daemon is stopped with:
+   xend stop
+
+   The daemon should reconnect to device control interfaces
+   and recover its state when restarted.
+
+   On Solaris, the daemons are SMF managed, and you should not attempt
+   to start xend by hand.
+"""
+import fcntl
+import glob
+import os
+import os.path
+import sys
+import socket
+import signal
+import time
+import commands
+
+from xen.xend.server import SrvDaemon
+
+class CheckError(ValueError):
+    pass
+
+def hline():
+    print >>sys.stderr, "*" * 70
+
+def msg(message):
+    print >>sys.stderr, "*" * 3, message
+
+def check_logging():
+    """Check python logging is installed and raise an error if not.
+    Logging is standard from Python 2.3 on.
+    """
+    try:
+        import logging
+    except ImportError:
+        hline()
+        msg("Python logging is not installed.")
+        msg("Use 'make install-logging' at the xen root to install.")
+        msg("")
+        msg("Alternatively download and install from")
+        msg("http://www.red-dove.com/python_logging.html";)
+        hline()
+        raise CheckError("logging is not installed")
+
+def check_user():
+    """Check that the effective user id is 0 (root).
+    """
+    if os.geteuid() != 0:
+        hline()
+        msg("Xend must be run as root.")
+        hline()
+        raise CheckError("invalid user")
+
+def start_daemon(daemon, *args):
+    if os.fork() == 0:
+        os.execvp(daemon, (daemon,) + args)
+
+def start_blktapctrl():
+    start_daemon("blktapctrl", "")
+
+def main():
+    try:
+        check_logging()
+        check_user()
+    except CheckError:
+        sys.exit(1)
+    
+    daemon = SrvDaemon.instance()
+    if not sys.argv[1:]:
+        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0]
+    elif sys.argv[1] == 'start':
+        if os.uname()[0] != "SunOS":
+            start_blktapctrl()
+        return daemon.start()
+    elif sys.argv[1] == 'trace_start':
+        start_blktapctrl()
+        return daemon.start(trace=1)
+    elif sys.argv[1] == 'stop':
+        return daemon.stop()
+    elif sys.argv[1] == 'reload':
+        return daemon.reloadConfig()
+    elif sys.argv[1] == 'restart':
+        start_blktapctrl()
+        return daemon.stop() or daemon.start()
+    elif sys.argv[1] == 'status':
+        return daemon.status()
+    else:
+        print 'not an option:', sys.argv[1]
+    return 1
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/tools/python/xen/xm/xm b/tools/python/xen/xm/xm
new file mode 100755
index 0000000..f4fd200
--- /dev/null
+++ b/tools/python/xen/xm/xm
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+#  -*- mode: python; -*-
+import sys
+
+from xen.xm import main
+
+main.main(sys.argv)
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.