network, bind mech: initialize before usage
@@ -243,11 +243,6 @@ func (l *podNIC) PlugPhase1() error {
return nil
}
- bindMechanism, err := l.getPhase1Binding()
- if err != nil {
- return err
- }
-
cachedDomainIface, err := l.loadCachedInterface()
if err != nil {
return err
@@ -262,6 +257,11 @@ func (l *podNIC) PlugPhase1() error {
}
}
if !doesExist {
+ bindMechanism, err := l.getPhase1Binding()
+ if err != nil {
+ return err
+ }
+
err = bindMechanism.discoverPodNetworkInterface()
if err != nil {
return err
@@ -311,11 +311,6 @@ func (l *podNIC) PlugPhase2(domain *api.Domain) error {
return nil
}
- bindMechanism, err := l.getPhase2Binding(domain)
- if err != nil {
- return err
- }
-
domainIface, err := l.loadCachedInterface()
if err != nil {
log.Log.Reason(err).Critical("failed to load cached interface configuration")
@@ -324,6 +319,11 @@ func (l *podNIC) PlugPhase2(domain *api.Domain) error {
log.Log.Reason(err).Critical("cached interface configuration doesn't exist")
}
+ bindMechanism, err := l.getPhase2Binding(domain)
+ if err != nil {
+ return err
+ }
+
pid := "self"
if err = bindMechanism.loadCachedVIF(pid); err != nil {
log.Log.Reason(err).Critical("failed to load cached vif configuration")
