* [PATCH v2 1/2] KVM-test: Add qemu-ifup-atbr0
[not found] <1303184574.2088.4.camel@freedom>
@ 2011-05-04 3:01 ` Amos Kong
2011-05-04 3:11 ` Asias He
2011-05-04 3:01 ` [PATCH v2 2/2] KVM-test: Setup private bridge in framework Amos Kong
1 sibling, 1 reply; 6+ messages in thread
From: Amos Kong @ 2011-05-04 3:01 UTC (permalink / raw)
To: autotest; +Cc: lmr, kvm
'atbr0' is a private bridge.
This script is used to setup tap device.
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/scripts/qemu-ifup-atbr0 | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
create mode 100755 client/tests/kvm/scripts/qemu-ifup-atbr0
diff --git a/client/tests/kvm/scripts/qemu-ifup-atbr0 b/client/tests/kvm/scripts/qemu-ifup-atbr0
new file mode 100755
index 0000000..82c7efa
--- /dev/null
+++ b/client/tests/kvm/scripts/qemu-ifup-atbr0
@@ -0,0 +1,6 @@
+#!/bin/sh
+switch=atbr0
+/sbin/ifconfig $1 0.0.0.0 up
+/usr/sbin/brctl addif ${switch} $1
+/usr/sbin/brctl setfd ${switch} 0
+/usr/sbin/brctl stp ${switch} off
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] KVM-test: Setup private bridge in framework
[not found] <1303184574.2088.4.camel@freedom>
2011-05-04 3:01 ` [PATCH v2 1/2] KVM-test: Add qemu-ifup-atbr0 Amos Kong
@ 2011-05-04 3:01 ` Amos Kong
1 sibling, 0 replies; 6+ messages in thread
From: Amos Kong @ 2011-05-04 3:01 UTC (permalink / raw)
To: autotest; +Cc: kvm
KVM users always use bridge network, there are also some limits in userspace
network, and userspace network is not officially supported by some companys.
Framework will clean configuration when private bridge is not used.
We can replace user net with private bridge if this setup is stable and
general enough.
Configure parameters:
bridge = private
priv_brname = atbr0
priv_subnet = 192.168.58
nic_script = scripts/qemu-ifup-atbr0
Signed-off-by: Amos Kong <akong@redhat.com>
---
0 files changed, 0 insertions(+), 0 deletions(-)
diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index 625b422..d2c38f3 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -196,6 +196,28 @@ def preprocess(test, params, env):
@param env: The environment (a dict-like object).
"""
error.context("preprocessing")
+
+ if params.get("bridge") == "private":
+ priv_brname = params.get("priv_brname", 'atbr0')
+ priv_subnet = params.get("priv_subnet", '192.168.58')
+ if priv_brname not in commands.getoutput("btctl show"):
+ logging.info("Setup private bridge: %s" % priv_brname)
+ commands.getoutput("brctl addbr %s" % priv_brname)
+ file("/proc/sys/net/ipv4/ip_forward", "w").write("1\n")
+ commands.getoutput("brctl stp %s on" % priv_brname)
+ commands.getoutput("brctl setfd %s 0" % priv_brname)
+ commands.getoutput("ifconfig %s %s.1 up" % (priv_brname,
+ priv_subnet))
+ commands.getoutput("iptables -t nat -A POSTROUTING -s %s.254/24 !"
+ " -d %s.254/24 -j MASQUERADE" % (priv_subnet, priv_subnet))
+ commands.getoutput("service dnsmasq stop")
+ commands.getoutput("dnsmasq --strict-order --bind-interfaces"
+ " --listen-address %s.1 --dhcp-range %s.1,%s.254"
+ " --pid-file=/tmp/dnsmasq.pid" %
+ (priv_subnet, priv_subnet, priv_subnet))
+ if priv_brname not in commands.getoutput("brctl show"):
+ raise error.TestError("Fail to setup private bridge.")
+
# Start tcpdump if it isn't already running
if "address_cache" not in env:
env["address_cache"] = {}
@@ -365,6 +387,18 @@ def postprocess(test, params, env):
int(params.get("post_command_timeout", "600")),
params.get("post_command_noncritical") == "yes")
+ if params.get("bridge") == "private":
+ priv_brname = params.get("priv_brname", 'atbr0')
+ priv_subnet = params.get("priv_subnet", '192.168.58')
+ if len(commands.getoutput("brctl show|grep %s" %
+ priv_brname).split()) < 4:
+ logging.info("Remove private bridge: %s" % priv_brname)
+ pid = file("/tmp/dnsmasq.pid").read()
+ os.kill(int(pid), 9)
+ commands.getoutput("ifconfig %s down" % priv_brname)
+ commands.getoutput("brctl delbr %s" % priv_brname)
+ commands.getoutput("iptables -t nat -D POSTROUTING -s %s.254/24 !"
+ " -d %s.254/24 -j MASQUERADE" % (priv_subnet, priv_subnet))
def postprocess_on_error(test, params, env):
"""
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] KVM-test: Add qemu-ifup-atbr0
2011-05-04 3:01 ` [PATCH v2 1/2] KVM-test: Add qemu-ifup-atbr0 Amos Kong
@ 2011-05-04 3:11 ` Asias He
2011-05-04 3:23 ` Lucas Meneghel Rodrigues
0 siblings, 1 reply; 6+ messages in thread
From: Asias He @ 2011-05-04 3:11 UTC (permalink / raw)
To: Amos Kong; +Cc: autotest, lmr, kvm
On 05/04/2011 11:01 AM, Amos Kong wrote:
> 'atbr0' is a private bridge.
> This script is used to setup tap device.
>
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
> client/tests/kvm/scripts/qemu-ifup-atbr0 | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
> create mode 100755 client/tests/kvm/scripts/qemu-ifup-atbr0
>
> diff --git a/client/tests/kvm/scripts/qemu-ifup-atbr0 b/client/tests/kvm/scripts/qemu-ifup-atbr0
> new file mode 100755
> index 0000000..82c7efa
> --- /dev/null
> +++ b/client/tests/kvm/scripts/qemu-ifup-atbr0
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +switch=atbr0
> +/sbin/ifconfig $1 0.0.0.0 up
> +/usr/sbin/brctl addif ${switch} $1
> +/usr/sbin/brctl setfd ${switch} 0
> +/usr/sbin/brctl stp ${switch} off
brctl is not in /usr/sbin but /sbin in some systems, e.g. Debian.
hj:~# which brctl
/sbin/brctl
Does dropping this absolute path to brctl sound better?
--
Best Regards,
Asias He
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] KVM-test: Add qemu-ifup-atbr0
2011-05-04 3:11 ` Asias He
@ 2011-05-04 3:23 ` Lucas Meneghel Rodrigues
2011-05-04 6:08 ` [PATCH v3 " Amos Kong
2011-05-04 6:10 ` [PATCH] KVM-test: Drop the absolute path of brctl/ifconfig Amos Kong
0 siblings, 2 replies; 6+ messages in thread
From: Lucas Meneghel Rodrigues @ 2011-05-04 3:23 UTC (permalink / raw)
To: Asias He; +Cc: autotest, kvm
On Wed, 2011-05-04 at 11:11 +0800, Asias He wrote:
> On 05/04/2011 11:01 AM, Amos Kong wrote:
> > 'atbr0' is a private bridge.
> > This script is used to setup tap device.
> >
> > Signed-off-by: Amos Kong <akong@redhat.com>
> > ---
> > client/tests/kvm/scripts/qemu-ifup-atbr0 | 6 ++++++
> > 1 files changed, 6 insertions(+), 0 deletions(-)
> > create mode 100755 client/tests/kvm/scripts/qemu-ifup-atbr0
> >
> > diff --git a/client/tests/kvm/scripts/qemu-ifup-atbr0 b/client/tests/kvm/scripts/qemu-ifup-atbr0
> > new file mode 100755
> > index 0000000..82c7efa
> > --- /dev/null
> > +++ b/client/tests/kvm/scripts/qemu-ifup-atbr0
> > @@ -0,0 +1,6 @@
> > +#!/bin/sh
> > +switch=atbr0
> > +/sbin/ifconfig $1 0.0.0.0 up
> > +/usr/sbin/brctl addif ${switch} $1
> > +/usr/sbin/brctl setfd ${switch} 0
> > +/usr/sbin/brctl stp ${switch} off
>
> brctl is not in /usr/sbin but /sbin in some systems, e.g. Debian.
>
> hj:~# which brctl
> /sbin/brctl
>
> Does dropping this absolute path to brctl sound better?
I was planning to revive Jason's patchset that replaced the qemu ifup
scripts altogether. If the scripts were to be kept, yes, dropping the
absolute path sound good.
Thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] KVM-test: Add qemu-ifup-atbr0
2011-05-04 3:23 ` Lucas Meneghel Rodrigues
@ 2011-05-04 6:08 ` Amos Kong
2011-05-04 6:10 ` [PATCH] KVM-test: Drop the absolute path of brctl/ifconfig Amos Kong
1 sibling, 0 replies; 6+ messages in thread
From: Amos Kong @ 2011-05-04 6:08 UTC (permalink / raw)
To: Lucas Meneghel Rodrigues; +Cc: Asias He, autotest, kvm
'atbr0' is a private bridge.
This script is used to setup tap device.
Changes from v2:
- drop the absolute path of brctl and ifconfig
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/scripts/qemu-ifup-atbr0 | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
create mode 100755 client/tests/kvm/scripts/qemu-ifup-atbr0
diff --git a/client/tests/kvm/scripts/qemu-ifup-atbr0 b/client/tests/kvm/scripts/qemu-ifup-atbr0
new file mode 100755
index 0000000..59f91b5
--- /dev/null
+++ b/client/tests/kvm/scripts/qemu-ifup-atbr0
@@ -0,0 +1,6 @@
+#!/bin/sh
+switch=atbr0
+ifconfig $1 0.0.0.0 up
+brctl addif ${switch} $1
+brctl setfd ${switch} 0
+brctl stp ${switch} off
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] KVM-test: Drop the absolute path of brctl/ifconfig
2011-05-04 3:23 ` Lucas Meneghel Rodrigues
2011-05-04 6:08 ` [PATCH v3 " Amos Kong
@ 2011-05-04 6:10 ` Amos Kong
1 sibling, 0 replies; 6+ messages in thread
From: Amos Kong @ 2011-05-04 6:10 UTC (permalink / raw)
To: Lucas Meneghel Rodrigues; +Cc: autotest, Asias He, kvm
The absolute paths of brctl are not same in different
distribution.
Signed-off-by: Amos Kong <akong@redhat.com>
---
client/tests/kvm/scripts/qemu-ifup | 12 ++++++------
client/tests/kvm/scripts/qemu-ifup-ipv6 | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/client/tests/kvm/scripts/qemu-ifup b/client/tests/kvm/scripts/qemu-ifup
index c4debf5..2f9c7fe 100755
--- a/client/tests/kvm/scripts/qemu-ifup
+++ b/client/tests/kvm/scripts/qemu-ifup
@@ -2,10 +2,10 @@
# The following expression selects the first bridge listed by 'brctl show'.
# Modify it to suit your needs.
-switch=$(/usr/sbin/brctl show | awk 'NR==2 { print $1 }')
+switch=$(brctl show | awk 'NR==2 { print $1 }')
-/bin/echo 1 > /proc/sys/net/ipv6/conf/${switch}/disable_ipv6
-/sbin/ifconfig $1 0.0.0.0 up
-/usr/sbin/brctl addif ${switch} $1
-/usr/sbin/brctl setfd ${switch} 0
-/usr/sbin/brctl stp ${switch} off
+echo 1 > /proc/sys/net/ipv6/conf/${switch}/disable_ipv6
+ifconfig $1 0.0.0.0 up
+brctl addif ${switch} $1
+brctl setfd ${switch} 0
+brctl stp ${switch} off
diff --git a/client/tests/kvm/scripts/qemu-ifup-ipv6 b/client/tests/kvm/scripts/qemu-ifup-ipv6
index d4b0592..a11c084 100755
--- a/client/tests/kvm/scripts/qemu-ifup-ipv6
+++ b/client/tests/kvm/scripts/qemu-ifup-ipv6
@@ -2,10 +2,10 @@
# The following expression selects the first bridge listed by 'brctl show'.
# Modify it to suit your needs.
-switch=$(/usr/sbin/brctl show | awk 'NR==2 { print $1 }')
+switch=$(brctl show | awk 'NR==2 { print $1 }')
-/bin/echo 0 > /proc/sys/net/ipv6/conf/${switch}/disable_ipv6
-/sbin/ifconfig $1 0.0.0.0 up
-/usr/sbin/brctl addif ${switch} $1
-/usr/sbin/brctl setfd ${switch} 0
-/usr/sbin/brctl stp ${switch} off
+echo 0 > /proc/sys/net/ipv6/conf/${switch}/disable_ipv6
+ifconfig $1 0.0.0.0 up
+brctl addif ${switch} $1
+brctl setfd ${switch} 0
+brctl stp ${switch} off
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-05-04 6:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1303184574.2088.4.camel@freedom>
2011-05-04 3:01 ` [PATCH v2 1/2] KVM-test: Add qemu-ifup-atbr0 Amos Kong
2011-05-04 3:11 ` Asias He
2011-05-04 3:23 ` Lucas Meneghel Rodrigues
2011-05-04 6:08 ` [PATCH v3 " Amos Kong
2011-05-04 6:10 ` [PATCH] KVM-test: Drop the absolute path of brctl/ifconfig Amos Kong
2011-05-04 3:01 ` [PATCH v2 2/2] KVM-test: Setup private bridge in framework Amos Kong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox