Skip to content

Commit

Permalink
Merge pull request #7271 from zexi/automated-cherry-pick-of-#7270-ups…
Browse files Browse the repository at this point in the history
…tream-release-3.3

Automated cherry pick of #7270: baremetal: set zone when enable netif
  • Loading branch information
yunion-ci-robot committed Jul 21, 2020
2 parents 194105f + df4d88e commit 3599904
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/compute/models/hosts.go
Expand Up @@ -4000,6 +4000,14 @@ func (self *SHost) EnableNetif(ctx context.Context, userCred mcclient.TokenCrede
if wire == nil {
return fmt.Errorf("No wire attached")
}
if self.ZoneId == "" {
if _, err := self.SaveUpdates(func() error {
self.ZoneId = wire.ZoneId
return nil
}); err != nil {
return errors.Wrapf(err, "set host zone_id %s by wire", wire.ZoneId)
}
}
hw, err := HostwireManager.FetchByHostIdAndMac(self.Id, netif.Mac)
if err != nil {
return err
Expand Down

0 comments on commit 3599904

Please sign in to comment.