mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
multicloud: ICloudNic: add GetId()
This commit is contained in:
@@ -329,6 +329,7 @@ type ICloudVM interface {
|
||||
}
|
||||
|
||||
type ICloudNic interface {
|
||||
GetId() string
|
||||
GetIP() string
|
||||
GetMAC() string
|
||||
InClassicNetwork() bool
|
||||
|
||||
@@ -341,6 +341,7 @@ func (self *SInstance) GetINics() ([]cloudprovider.ICloudNic, error) {
|
||||
for _, networkInterface := range networkInterfaces {
|
||||
nic := SInstanceNic{
|
||||
instance: self,
|
||||
id: networkInterface.NetworkInterfaceId,
|
||||
ipAddr: networkInterface.PrimaryIpAddress,
|
||||
macAddr: networkInterface.MacAddress,
|
||||
}
|
||||
|
||||
@@ -20,10 +20,15 @@ import (
|
||||
|
||||
type SInstanceNic struct {
|
||||
instance *SInstance
|
||||
id string
|
||||
ipAddr string
|
||||
macAddr string
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return self.id
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetIP() string {
|
||||
return self.ipAddr
|
||||
}
|
||||
|
||||
@@ -341,6 +341,7 @@ func (self *SInstance) GetINics() ([]cloudprovider.ICloudNic, error) {
|
||||
for _, networkInterface := range networkInterfaces {
|
||||
nic := SInstanceNic{
|
||||
instance: self,
|
||||
id: networkInterface.NetworkInterfaceId,
|
||||
ipAddr: networkInterface.PrimaryIpAddress,
|
||||
macAddr: networkInterface.MacAddress,
|
||||
}
|
||||
|
||||
@@ -20,8 +20,15 @@ import (
|
||||
|
||||
type SInstanceNic struct {
|
||||
instance *SInstance
|
||||
id string
|
||||
ipAddr string
|
||||
macAddr string
|
||||
|
||||
cloudprovider.DummyICloudNic
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return self.id
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetIP() string {
|
||||
|
||||
@@ -24,6 +24,10 @@ type SInstanceNic struct {
|
||||
macAddr string
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetIP() string {
|
||||
return self.ipAddr
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ type SClassicInstanceNic struct {
|
||||
Location string
|
||||
}
|
||||
|
||||
func (self *SClassicInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SClassicInstanceNic) GetIP() string {
|
||||
return self.IP
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
|
||||
@@ -47,6 +47,10 @@ func (self *SInstanceNic) GetMAC() string {
|
||||
return self.MACAddr
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetDriver() string {
|
||||
return "virtio"
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ func (nic *SVirtualNIC) getVirtualEthernetCard() *types.VirtualEthernetCard {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (nic *SVirtualNIC) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (nic *SVirtualNIC) GetIP() string {
|
||||
guestIps := nic.vm.getGuestIps()
|
||||
if ip, ok := guestIps[nic.GetMAC()]; ok {
|
||||
|
||||
@@ -33,6 +33,10 @@ type SNetworkInterface struct {
|
||||
Kind string
|
||||
}
|
||||
|
||||
func (nic *SNetworkInterface) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (nic *SNetworkInterface) GetIP() string {
|
||||
return nic.NetworkIP
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ type SInstanceNic struct {
|
||||
macAddr string
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetIP() string {
|
||||
return self.ipAddr
|
||||
}
|
||||
|
||||
@@ -59,6 +59,10 @@ func (region *SRegion) GetInstancePorts(instanceId string) ([]SInstancePort, err
|
||||
return ports, nil
|
||||
}
|
||||
|
||||
func (nic *SInstancePort) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (nic *SInstancePort) GetIP() string {
|
||||
for i := range nic.FixedIps {
|
||||
if regutils.MatchIPAddr(nic.FixedIps[i].IpAddress) {
|
||||
|
||||
@@ -26,6 +26,10 @@ type SInstanceNic struct {
|
||||
classic bool
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetIP() string {
|
||||
return self.ipAddr
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ type SInstanceNic struct {
|
||||
macAddr string
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (self *SInstanceNic) GetIP() string {
|
||||
return self.ipAddr
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ type SInstanceNic struct {
|
||||
ZStackTime
|
||||
}
|
||||
|
||||
func (nic *SInstanceNic) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (nic *SInstanceNic) GetIP() string {
|
||||
return nic.IP
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user