Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit bbf1895

Browse files
committed
Merge pull request #16 from feiskyer/update-host-binding
Update host binding for neutron port
2 parents 0989942 + bfd97ae commit bbf1895

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/common/openstack.go

+15
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,21 @@ func (os *OpenStack) SetupPod(podName, namespace, podInfraContainerID string, ne
13581358
return err
13591359
}
13601360

1361+
deviceOwner := fmt.Sprintf("compute:%s", getHostName())
1362+
if port.DeviceOwner != deviceOwner {
1363+
// Update hostname in order to make sure it is correct
1364+
updateOpts := ports.UpdateOpts{
1365+
HostID: getHostName(),
1366+
DeviceOwner: deviceOwner,
1367+
}
1368+
_, err = ports.Update(os.network, port.ID, updateOpts).Extract()
1369+
if err != nil {
1370+
ports.Delete(os.network, port.ID)
1371+
glog.Errorf("Update port %s failed: %v", portName, err)
1372+
return err
1373+
}
1374+
}
1375+
13611376
glog.V(4).Infof("Pod %s's port is %v", podName, port)
13621377

13631378
// get subnet and gateway

0 commit comments

Comments
 (0)