diff options
| author | Akihiro MOTOKI <motoki@da.jp.nec.com> | 2012-09-21 10:08:43 +0900 |
|---|---|---|
| committer | Salvatore Orlando <salv.orlando@gmail.com> | 2012-09-21 03:37:00 -0700 |
| commit | 577ba6267994baecd5f9e05105624536d320cc9b (patch) | |
| tree | 11cc38daab621f7adb98cfed2a44a57feb4b48b6 | |
| parent | 075e7888f00c9e614364674534a168c6635e162a (diff) | |
Ensure hybrid driver creates veth pair only once.
Fixes bug 1053312
This commit fixes a bug that an instance can't obtain IP address by DHCP
when using LibvirtHybridOVSBridgeDriver. When nova-compute launches an
instance on KVM, vif driver plug() may be called twice and this causes
a behavior that a port of OVS cannot seen as a bridge port. So this patch
make sure create_veth_pair() is not called if a port already exists.
Change-Id: I76792df9f0dd28224d7d57989bf1e8ecadb92606
| -rw-r--r-- | nova/virt/libvirt/vif.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index 1a64765b1..ea0834d87 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -212,15 +212,15 @@ class LibvirtHybridOVSBridgeDriver(LibvirtBridgeDriver, br_name = self.get_br_name(iface_id) v1_name, v2_name = self.get_veth_pair_names(iface_id) - linux_net._create_veth_pair(v1_name, v2_name) - if not linux_net._device_exists(br_name): utils.execute('brctl', 'addbr', br_name, run_as_root=True) - utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True) - utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True) - self.create_ovs_vif_port(v2_name, iface_id, mapping['mac'], - instance['uuid']) + if not linux_net._device_exists(v2_name): + linux_net._create_veth_pair(v1_name, v2_name) + utils.execute('ip', 'link', 'set', br_name, 'up', run_as_root=True) + utils.execute('brctl', 'addif', br_name, v1_name, run_as_root=True) + self.create_ovs_vif_port(v2_name, iface_id, mapping['mac'], + instance['uuid']) network['bridge'] = br_name return self._get_configurations(instance, network, mapping) |
