diff --git a/src/agent/src/rpc.rs b/src/agent/src/rpc.rs index a909f9b70a..4e2801dfce 100644 --- a/src/agent/src/rpc.rs +++ b/src/agent/src/rpc.rs @@ -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) diff --git a/src/libs/protocols/protos/types.proto b/src/libs/protocols/protos/types.proto index 2ff6b7ab7e..a60cbbc326 100644 --- a/src/libs/protocols/protos/types.proto +++ b/src/libs/protocols/protos/types.proto @@ -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 diff --git a/src/runtime-rs/crates/agent/src/kata/trans.rs b/src/runtime-rs/crates/agent/src/kata/trans.rs index bb2aa72504..895540c8b0 100644 --- a/src/runtime-rs/crates/agent/src/kata/trans.rs +++ b/src/runtime-rs/crates/agent/src/kata/trans.rs @@ -188,7 +188,7 @@ impl From 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 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, } diff --git a/src/runtime-rs/crates/agent/src/types.rs b/src/runtime-rs/crates/agent/src/types.rs index c89fdc675f..ed4f1cf603 100644 --- a/src/runtime-rs/crates/agent/src/types.rs +++ b/src/runtime-rs/crates/agent/src/types.rs @@ -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)] diff --git a/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_dan.rs b/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_dan.rs index 5ca06d340c..1c8c684a14 100644 --- a/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_dan.rs +++ b/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_dan.rs @@ -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, }; diff --git a/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_link.rs b/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_link.rs index d6dc0a82b6..bc969d7de3 100644 --- a/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_link.rs +++ b/src/runtime-rs/crates/resource/src/network/network_info/network_info_from_link.rs @@ -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, }, diff --git a/src/runtime/virtcontainers/network.go b/src/runtime/virtcontainers/network.go index 42b456cc6e..ff09818d2a 100644 --- a/src/runtime/virtcontainers/network.go +++ b/src/runtime/virtcontainers/network.go @@ -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) diff --git a/src/runtime/virtcontainers/pkg/agent/protocols/types.pb.go b/src/runtime/virtcontainers/pkg/agent/protocols/types.pb.go index d50fc8d60b..91660c7249 100644 --- a/src/runtime/virtcontainers/pkg/agent/protocols/types.pb.go +++ b/src/runtime/virtcontainers/pkg/agent/protocols/types.pb.go @@ -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 "" } diff --git a/src/runtime/virtcontainers/sandbox.go b/src/runtime/virtcontainers/sandbox.go index 3711da7f5e..1ded0b963a 100644 --- a/src/runtime/virtcontainers/sandbox.go +++ b/src/runtime/virtcontainers/sandbox.go @@ -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