ia64/xen-unstable

view tools/python/xen/xend/XendClient.py @ 12725:36fe7ca48e54

Tidy up the creation of directories that Xend needs. This avoids potential
races in this creation.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Dec 01 11:32:32 2006 +0000 (2006-12-01)
parents ee70bf177981
children b13a95fc0e2f
line source
1 #!/usr/bin/env python
2 #============================================================================
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of version 2.1 of the GNU Lesser General Public
5 # License as published by the Free Software Foundation.
6 #
7 # This library is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 # Lesser General Public License for more details.
11 #
12 # You should have received a copy of the GNU Lesser General Public
13 # License along with this library; if not, write to the Free Software
14 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 #============================================================================
16 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
17 # Copyright (C) 2006 Anthony Liguori <aliguori@us.ibm.com>
18 #============================================================================
20 from xen.util.xmlrpclib2 import ServerProxy
21 import os
22 import sys
24 XML_RPC_SOCKET = "/var/run/xend/xmlrpc.sock"
25 XEN_API_SOCKET = "/var/run/xend/xen-api.sock"
27 ERROR_INTERNAL = 1
28 ERROR_GENERIC = 2
29 ERROR_INVALID_DOMAIN = 3
31 uri = 'httpu:///var/run/xend/xmlrpc.sock'
32 if os.environ.has_key('XM_SERVER'):
33 uri = os.environ['XM_SERVER']
35 try:
36 server = ServerProxy(uri)
37 except ValueError, exn:
38 print >>sys.stderr, exn
39 sys.exit(1)