mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-02 08:17:01 +00:00
proto: Rename Interface.pciPath to devicePath
Field is being used for both PCI and CCW devices. Name it devicePath to avoid confusion when the device isn't a PCI device. Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
parent
47a5439a20
commit
9935f9ea7e
@ -1002,8 +1002,8 @@ impl agent_ttrpc::AgentService for AgentService {
|
||||
|
||||
// For network devices passed on the pci bus, check for the network interface
|
||||
// to be available first.
|
||||
if !interface.pciPath.is_empty() {
|
||||
let pcipath = pci::Path::from_str(&interface.pciPath)
|
||||
if !interface.devicePath.is_empty() {
|
||||
let pcipath = pci::Path::from_str(&interface.devicePath)
|
||||
.map_ttrpc_err(|e| format!("Unexpected pci-path for network interface: {:?}", e))?;
|
||||
|
||||
wait_for_net_interface(&self.sandbox, &pcipath)
|
||||
|
@ -38,8 +38,10 @@ message Interface {
|
||||
uint64 mtu = 4;
|
||||
string hwAddr = 5;
|
||||
|
||||
// PCI path for the device (see the pci::Path (Rust) or types.PciPath (Go) type for format details)
|
||||
string pciPath = 6;
|
||||
// Path for the device (see the pci::Path (Rust) and types.PciPath
|
||||
// (Go) or ccw::Device (Rust) types for format details, depending on
|
||||
// architecture)
|
||||
string devicePath = 6;
|
||||
|
||||
// Type defines the type of interface described by this structure.
|
||||
// The expected values are the one that are defined by the netlink
|
||||
|
@ -188,7 +188,7 @@ impl From<Interface> for types::Interface {
|
||||
IPAddresses: trans_vec(from.ip_addresses),
|
||||
mtu: from.mtu,
|
||||
hwAddr: from.hw_addr,
|
||||
pciPath: from.pci_addr,
|
||||
devicePath: from.device_path,
|
||||
type_: from.field_type,
|
||||
raw_flags: from.raw_flags,
|
||||
..Default::default()
|
||||
@ -204,7 +204,7 @@ impl From<types::Interface> for Interface {
|
||||
ip_addresses: trans_vec(src.IPAddresses),
|
||||
mtu: src.mtu,
|
||||
hw_addr: src.hwAddr,
|
||||
pci_addr: src.pciPath,
|
||||
device_path: src.devicePath,
|
||||
field_type: src.type_,
|
||||
raw_flags: src.raw_flags,
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ pub struct Interface {
|
||||
pub mtu: u64,
|
||||
pub hw_addr: String,
|
||||
#[serde(default)]
|
||||
pub pci_addr: String,
|
||||
pub device_path: String,
|
||||
#[serde(default)]
|
||||
pub field_type: String,
|
||||
#[serde(default)]
|
||||
|
@ -53,7 +53,7 @@ impl NetworkInfoFromDan {
|
||||
ip_addresses,
|
||||
mtu: dan_device.network_info.interface.mtu,
|
||||
hw_addr: dan_device.guest_mac.clone(),
|
||||
pci_addr: String::default(),
|
||||
device_path: String::default(),
|
||||
field_type: dan_device.network_info.interface.ntype.clone(),
|
||||
raw_flags: dan_device.network_info.interface.flags & IFF_NOARP,
|
||||
};
|
||||
@ -181,7 +181,7 @@ mod tests {
|
||||
}],
|
||||
mtu: 1500,
|
||||
hw_addr: "xx:xx:xx:xx:xx".to_owned(),
|
||||
pci_addr: String::default(),
|
||||
device_path: String::default(),
|
||||
field_type: "tuntap".to_owned(),
|
||||
raw_flags: 0,
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ impl NetworkInfoFromLink {
|
||||
ip_addresses: addrs.clone(),
|
||||
mtu: attrs.mtu as u64,
|
||||
hw_addr: hw_addr.to_string(),
|
||||
pci_addr: Default::default(),
|
||||
device_path: Default::default(),
|
||||
field_type: link.r#type().to_string(),
|
||||
raw_flags: attrs.flags & libc::IFF_NOARP as u32,
|
||||
},
|
||||
|
@ -271,7 +271,7 @@ func generateVCNetworkStructures(ctx context.Context, endpoints []Endpoint) ([]*
|
||||
Type: string(endpoint.Type()),
|
||||
RawFlags: noarp,
|
||||
HwAddr: endpoint.HardwareAddr(),
|
||||
PciPath: endpoint.PciPath().String(),
|
||||
DevicePath: endpoint.PciPath().String(),
|
||||
}
|
||||
|
||||
ifaces = append(ifaces, &ifc)
|
||||
|
@ -196,8 +196,10 @@ type Interface struct {
|
||||
IPAddresses []*IPAddress `protobuf:"bytes,3,rep,name=IPAddresses,proto3" json:"IPAddresses,omitempty"`
|
||||
Mtu uint64 `protobuf:"varint,4,opt,name=mtu,proto3" json:"mtu,omitempty"`
|
||||
HwAddr string `protobuf:"bytes,5,opt,name=hwAddr,proto3" json:"hwAddr,omitempty"`
|
||||
// PCI path for the device (see the pci::Path (Rust) or types.PciPath (Go) type for format details)
|
||||
PciPath string `protobuf:"bytes,6,opt,name=pciPath,proto3" json:"pciPath,omitempty"`
|
||||
// Path for the device (see the pci::Path (Rust) and types.PciPath
|
||||
// (Go) or ccw::Device (Rust) types for format details, depending on
|
||||
// architecture)
|
||||
DevicePath string `protobuf:"bytes,6,opt,name=devicePath,proto3" json:"devicePath,omitempty"`
|
||||
// Type defines the type of interface described by this structure.
|
||||
// The expected values are the one that are defined by the netlink
|
||||
// library, regarding each type of link. Here is a non exhaustive
|
||||
@ -273,9 +275,9 @@ func (x *Interface) GetHwAddr() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Interface) GetPciPath() string {
|
||||
func (x *Interface) GetDevicePath() string {
|
||||
if x != nil {
|
||||
return x.PciPath
|
||||
return x.DevicePath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ func (s *Sandbox) AddInterface(ctx context.Context, inf *pbTypes.Interface) (*pb
|
||||
}()
|
||||
|
||||
// Add network for vm
|
||||
inf.PciPath = endpoints[0].PciPath().String()
|
||||
inf.DevicePath = endpoints[0].PciPath().String()
|
||||
result, err := s.agent.updateInterface(ctx, inf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user