~juju-qa/ubuntu/xenial/juju/2.0-rc2

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/provider/maas/devices.go

  • Committer: Nicholas Skaggs
  • Date: 2016-09-30 14:39:30 UTC
  • mfrom: (1.8.1)
  • Revision ID: nicholas.skaggs@canonical.com-20160930143930-vwwhrefh6ftckccy
import upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
                }
213
213
 
214
214
                for _, link := range nic.Links {
215
 
                        switch link.Mode {
216
 
                        case modeUnknown:
217
 
                                nicInfo.ConfigType = network.ConfigUnknown
218
 
                        case modeDHCP:
219
 
                                nicInfo.ConfigType = network.ConfigDHCP
220
 
                        case modeStatic, modeLinkUp:
221
 
                                nicInfo.ConfigType = network.ConfigStatic
222
 
                        default:
223
 
                                nicInfo.ConfigType = network.ConfigManual
224
 
                        }
 
215
                        nicInfo.ConfigType = maasLinkToInterfaceConfigType(string(link.Mode))
225
216
 
226
217
                        if link.IPAddress == "" {
227
218
                                logger.Debugf("device %q interface %q has no address", deviceID, nic.Name)
 
219
                                interfaceInfo = append(interfaceInfo, nicInfo)
228
220
                                continue
229
221
                        }
 
222
 
230
223
                        if link.Subnet == nil {
231
224
                                logger.Debugf("device %q interface %q link %d missing subnet", deviceID, nic.Name, link.ID)
 
225
                                interfaceInfo = append(interfaceInfo, nicInfo)
232
226
                                continue
233
227
                        }
234
228
 
290
284
                }
291
285
 
292
286
                for _, link := range nic.Links() {
293
 
                        mode := maasLinkMode(link.Mode())
294
 
                        switch mode {
295
 
                        case modeUnknown:
296
 
                                nicInfo.ConfigType = network.ConfigUnknown
297
 
                        case modeDHCP:
298
 
                                nicInfo.ConfigType = network.ConfigDHCP
299
 
                        case modeStatic, modeLinkUp:
300
 
                                nicInfo.ConfigType = network.ConfigStatic
301
 
                        default:
302
 
                                nicInfo.ConfigType = network.ConfigManual
303
 
                        }
 
287
                        nicInfo.ConfigType = maasLinkToInterfaceConfigType(link.Mode())
304
288
 
305
289
                        subnet := link.Subnet()
306
290
                        if link.IPAddress() == "" || subnet == nil {
307
291
                                logger.Debugf("device %q interface %q has no address", deviceID, nic.Name())
 
292
                                interfaceInfo = append(interfaceInfo, nicInfo)
308
293
                                continue
309
294
                        }
310
295