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

[Xen-devel] [PATCH] xend: drbd improvements



# HG changeset patch
# User Jim Fehlig <jfehlig@xxxxxxxxxx>
# Date 1289324668 25200
# Node ID fb0498c0cbdd6be20bbcb5560779ad6f380fe9e8
# Parent  985f5fa8fc59f84c8577c482df6246258c785991
xend: drbd improvements

1) drbdadm state is debrecated, and the script tries to detect the
primary/secondary information from the deprecated message
2) os.popen2 does not work with the array as argument
3) popen2 is deprecated since python2.6

Re: http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1685

    From: Berthold Gunreben <bg@xxxxxxx>
    Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>

diff -r 985f5fa8fc59 -r fb0498c0cbdd tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Nov 08 17:25:54 2010 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Nov 09 10:44:28 2010 -0700
@@ -35,6 +35,7 @@
 import shutil
 import traceback
 from types import StringTypes
+from subprocess import *
 
 import xen.lowlevel.xc
 from xen.util import asserts, auxbin, mkdir
@@ -3254,7 +3255,9 @@
             if disk.find(":") != -1:
                 (disktype, diskname) = disk.split(':', 1)
                 if disktype == 'drbd':
-                    (drbdadmstdin, drbdadmstdout) = 
os.popen2(["/sbin/drbdadm", "state", diskname])
+                    p = Popen(["/sbin/drbdadm", "role", diskname],
+                              stdin=PIPE, stdout=PIPE, close_fds=True )
+                    (drbdadmstdin, drbdadmstdout) = (p.stdin, p.stdout)
                     (state, junk) = drbdadmstdout.readline().split('/', 1)
                     if state == 'Secondary':
                         os.system('/sbin/drbdadm primary ' + diskname)

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


 


Rackspace

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