From patchwork Sat Jan 22 02:03:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 497541 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0M23uXd006740 for ; Sat, 22 Jan 2011 02:04:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754263Ab1AVCD5 (ORCPT ); Fri, 21 Jan 2011 21:03:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6651 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752608Ab1AVCD4 (ORCPT ); Fri, 21 Jan 2011 21:03:56 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0M23tWm009716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Jan 2011 21:03:55 -0500 Received: from freedom.redhat.com (vpn-11-112.rdu.redhat.com [10.11.11.112]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0M23ntn030188; Fri, 21 Jan 2011 21:03:54 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH 2/4] KVM test: Renaming join_mcast.py to multicast_guest.py Date: Sat, 22 Jan 2011 00:03:45 -0200 Message-Id: <1295661827-30803-3-git-send-email-lmr@redhat.com> In-Reply-To: <1295661827-30803-1-git-send-email-lmr@redhat.com> References: <1295661827-30803-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 22 Jan 2011 02:04:15 +0000 (UTC) diff --git a/client/tests/kvm/scripts/join_mcast.py b/client/tests/kvm/scripts/join_mcast.py deleted file mode 100755 index 350cd5f..0000000 --- a/client/tests/kvm/scripts/join_mcast.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python -import socket, struct, os, signal, sys -# -*- coding: utf-8 -*- - -""" -Script used to join machine into multicast groups. - -@author Amos Kong -""" - -if __name__ == "__main__": - if len(sys.argv) < 4: - print """%s [mgroup_count] [prefix] [suffix] - mgroup_count: count of multicast addresses - prefix: multicast address prefix - suffix: multicast address suffix""" % sys.argv[0] - sys.exit() - - mgroup_count = int(sys.argv[1]) - prefix = sys.argv[2] - suffix = int(sys.argv[3]) - - s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - for i in range(mgroup_count): - mcast = prefix + "." + str(suffix + i) - try: - mreq = struct.pack("4sl", socket.inet_aton(mcast), - socket.INADDR_ANY) - s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) - except: - s.close() - print "Could not join multicast: %s" % mcast - raise - - print "join_mcast_pid:%s" % os.getpid() - os.kill(os.getpid(), signal.SIGSTOP) - s.close() diff --git a/client/tests/kvm/scripts/multicast_guest.py b/client/tests/kvm/scripts/multicast_guest.py new file mode 100755 index 0000000..350cd5f --- /dev/null +++ b/client/tests/kvm/scripts/multicast_guest.py @@ -0,0 +1,37 @@ +#!/usr/bin/python +import socket, struct, os, signal, sys +# -*- coding: utf-8 -*- + +""" +Script used to join machine into multicast groups. + +@author Amos Kong +""" + +if __name__ == "__main__": + if len(sys.argv) < 4: + print """%s [mgroup_count] [prefix] [suffix] + mgroup_count: count of multicast addresses + prefix: multicast address prefix + suffix: multicast address suffix""" % sys.argv[0] + sys.exit() + + mgroup_count = int(sys.argv[1]) + prefix = sys.argv[2] + suffix = int(sys.argv[3]) + + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + for i in range(mgroup_count): + mcast = prefix + "." + str(suffix + i) + try: + mreq = struct.pack("4sl", socket.inet_aton(mcast), + socket.INADDR_ANY) + s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) + except: + s.close() + print "Could not join multicast: %s" % mcast + raise + + print "join_mcast_pid:%s" % os.getpid() + os.kill(os.getpid(), signal.SIGSTOP) + s.close() diff --git a/client/tests/kvm/tests/multicast.py b/client/tests/kvm/tests/multicast.py index ddb7807..5dfecbc 100644 --- a/client/tests/kvm/tests/multicast.py +++ b/client/tests/kvm/tests/multicast.py @@ -53,9 +53,9 @@ def run_multicast(test, params, env): prefix = re.findall("\d+.\d+.\d+", mcast)[0] suffix = int(re.findall("\d+", mcast)[-1]) # copy python script to guest for joining guest to multicast groups - mcast_path = os.path.join(test.bindir, "scripts/join_mcast.py") + mcast_path = os.path.join(test.bindir, "scripts/multicast_guest.py") vm.copy_files_to(mcast_path, "/tmp") - output = session.cmd_output("python /tmp/join_mcast.py %d %s %d" % + output = session.cmd_output("python /tmp/multicast_guest.py %d %s %d" % (mgroup_count, prefix, suffix)) # if success to join multicast, the process will be paused, and return PID.