xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xend: drbd improvements
@ 2010-11-09 17:50 Jim Fehlig
  2010-11-09 18:26 ` Ian Jackson
  0 siblings, 1 reply; 15+ messages in thread
From: Jim Fehlig @ 2010-11-09 17:50 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Jim Fehlig <jfehlig@novell.com>
# 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@suse.de>
    Signed-off-by: Jim Fehlig <jfehlig@novell.com>

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)

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

end of thread, other threads:[~2011-01-18 17:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-09 17:50 [PATCH] xend: drbd improvements Jim Fehlig
2010-11-09 18:26 ` Ian Jackson
2010-11-09 22:21   ` Jim Fehlig
2010-11-10 17:49     ` Jim Fehlig
2010-12-17  0:45       ` Jim Fehlig
2010-12-17  0:58         ` Shriram Rajagopalan
2010-12-17  3:46           ` Jim Fehlig
2011-01-05 23:32         ` Ian Jackson
2011-01-06 17:48           ` Shriram Rajagopalan
2011-01-10 23:31             ` Jim Fehlig
2011-01-13  3:38               ` Jim Fehlig
2011-01-13  7:36                 ` Shriram Rajagopalan
2011-01-13 11:45                 ` Ian Jackson
2011-01-13 15:59                   ` Jim Fehlig
2011-01-18 17:24               ` Ian Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).