[CRIU] p.haul incorrect lxc assumption

Sowmini Varadhan sowmini.varadhan at oracle.com
Sat Nov 1 19:02:04 PDT 2014


I set up my container using "lxc create -n iperfs -t busybox",
and the resulting lxc.config file has network.type = veth,
which means that lxc will automatically create a veth.pair for
you, but seems like the p_haul_lxc.py script *always* expects
the veth.pair to be manually set up- it fails with

> Traceback (most recent call last):
>   File "/home/sowmini/src/p.haul/p.haul", line 39, in <module>
>     worker.start_migration()
>   File "/home/sowmini/src/p.haul/p_haul_iters.py", line 193, in
> start_migration self.htype.net_lock()
>   File "/home/sowmini/src/p.haul/p_haul_lxc.py", line 146, in net_lock
>     util.ifdown(veth.pair)

So I'm using the patch below to fix this - I am sure the brcmd 
and python syntax can be cleaned up, and perhaps we can just
use brctl at all times to figure out veth.link and veth.name,
instead of reading the config file. Comments?

diff --git a/p.haul b/p.haul
index b8f050e..8c7f181 100755
--- a/p.haul
+++ b/p.haul
@@ -1,4 +1,4 @@
diff --git a/p_haul_lxc.py b/p_haul_lxc.py
index 27df698..11d787d 100644
--- a/p_haul_lxc.py
+++ b/p_haul_lxc.py
@@ -54,6 +54,12 @@ class p_haul_type:
                                veth.name = v
                        elif k == "lxc.network.veth.pair":
                                veth.pair = v
+               if veth.link == "lxcbr0":
+                       brcmd = "brctl show "+ veth.link
+                       brcmd = brcmd + "|grep " + veth.link 
+                       brcmd = brcmd + "|awk '{print $4}'"
+                       f = os.popen(brcmd)
+                       veth.pair = f.read().rstrip('\n')
                if veth:
                        self._veths.append(veth)
                ifd.close()

 



More information about the CRIU mailing list