With Xen, the interfaces aren't set in 'tuntap' mode so 'ip tuntap list' doesn't show them.
Signed-off-by: Petr Pudlak <[email protected]> --- lib/hypervisor/hv_base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py index 8ffa31e..31221fb 100644 --- a/lib/hypervisor/hv_base.py +++ b/lib/hypervisor/hv_base.py @@ -183,20 +183,20 @@ def GenerateTapName(): NIC is not used in instance communication """ - result = utils.RunCmd(["ip", "tuntap", "list"]) + result = utils.RunCmd(["ip", "link", "show"]) if result.failed: raise errors.HypervisorError("Failed to list TUN/TAP interfaces") idxs = set() - for line in result.output.splitlines(): - parts = line.split(": ", 1) + for line in result.output.splitlines()[0::2]: + parts = line.split(": ") if len(parts) < 2: raise errors.HypervisorError("Failed to parse TUN/TAP interfaces") - r = re.match(r"gnt\.com\.([0-9]+)", parts[0]) + r = re.match(r"gnt\.com\.([0-9]+)", parts[1]) if r is not None: idxs.add(int(r.group(1))) -- 2.1.0.rc2.206.gedb03e5
