protocols: Update PCI path names / terminology in agent protocol def

Now that we have types to represent PCI paths on both the agent and
runtime sides, we can update the protocol definitionto use clearer
terminology.

Note that this doesn't actually change the agent protocol, because it just
renames a field without changing its field ID or type.

While we're there fix a trivial rustfmt error in
src/agent/protocols/build.rs

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2020-12-15 20:46:54 +11:00
parent 8e5fd8ee84
commit 7e92831c7a
4 changed files with 45 additions and 49 deletions

View File

@ -29,10 +29,8 @@ message Interface {
uint64 mtu = 4;
string hwAddr = 5;
// pciAddr is the PCI address in the format "bridgeAddr/deviceAddr".
// Here, bridgeAddr is the address at which the bridge is attached on the root bus,
// while deviceAddr is the address at which the network device is attached on the bridge.
string pciAddr = 6;
// PCI path for the device (see the pci::Path (Rust) or types.PciPath (Go) type for format details)
string pciPath = 6;
// Type defines the type of interface described by this structure.
// The expected values are the one that are defined by the netlink

View File

@ -984,7 +984,7 @@ func generateVCNetworkStructures(networkNS NetworkNamespace) ([]*pbTypes.Interfa
Mtu: uint64(endpoint.Properties().Iface.MTU),
RawFlags: noarp,
HwAddr: endpoint.HardwareAddr(),
PciAddr: endpoint.PciAddr(),
PciPath: endpoint.PciAddr(),
}
ifaces = append(ifaces, &ifc)

View File

@ -96,10 +96,8 @@ 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"`
// pciAddr is the PCI address in the format "bridgeAddr/deviceAddr".
// Here, bridgeAddr is the address at which the bridge is attached on the root bus,
// while deviceAddr is the address at which the network device is attached on the bridge.
PciAddr string `protobuf:"bytes,6,opt,name=pciAddr,proto3" json:"pciAddr,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"`
// 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
@ -242,37 +240,37 @@ func init() {
}
var fileDescriptor_b0c68e5b9fabcd81 = []byte{
// 470 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x31, 0x8f, 0xda, 0x30,
0x14, 0xc7, 0x31, 0x21, 0x39, 0x62, 0x74, 0x2d, 0xb2, 0xaa, 0x93, 0xd5, 0x4a, 0x51, 0xc4, 0xd2,
0xa8, 0x52, 0x89, 0x44, 0xab, 0xee, 0xd7, 0xe1, 0x24, 0x96, 0x8a, 0x7a, 0x6b, 0x97, 0xca, 0x18,
0x13, 0x22, 0x92, 0x38, 0xb2, 0x1d, 0x10, 0xea, 0xd2, 0x2f, 0xd2, 0xef, 0x73, 0x63, 0xc7, 0x8e,
0x77, 0x7c, 0x92, 0xca, 0x76, 0x40, 0x29, 0xed, 0x72, 0x13, 0xff, 0xdf, 0x7b, 0x36, 0xef, 0xff,
0xfe, 0x18, 0xf8, 0x39, 0xcb, 0xf5, 0xa6, 0x59, 0x4e, 0x99, 0x28, 0xd3, 0x2d, 0xd5, 0xf4, 0x2d,
0x13, 0x95, 0xa6, 0x79, 0xc5, 0xa5, 0xfa, 0x87, 0x95, 0x64, 0x29, 0xcd, 0x78, 0xa5, 0xd3, 0x5a,
0x0a, 0x2d, 0x98, 0x28, 0x94, 0x53, 0x2a, 0xd5, 0x87, 0x9a, 0xab, 0xa9, 0x05, 0xe4, 0x5b, 0x98,
0x2c, 0x61, 0x38, 0x5f, 0xdc, 0xae, 0x56, 0x92, 0x2b, 0x85, 0x5e, 0xc3, 0x60, 0x4d, 0xcb, 0xbc,
0x38, 0x60, 0x10, 0x83, 0xe4, 0xd9, 0xec, 0xf9, 0xd4, 0xdd, 0x98, 0x2f, 0xee, 0x6c, 0x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0xdc, 0x1f, 0x23, 0xf0, 0xeb, 0x18, 0x81, 0x87, 0x63,
0x04, 0xbe, 0x7e, 0x79, 0xe2, 0x9d, 0x97, 0x4d, 0xa5, 0xf3, 0x92, 0xa7, 0xbb, 0x5c, 0xea, 0xce,
0x52, 0xbd, 0xcd, 0x2e, 0x7f, 0x87, 0x65, 0x60, 0xe5, 0xbb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff,
0xed, 0x3e, 0x9a, 0x58, 0x57, 0x03, 0x00, 0x00,
}
func (m *IPAddress) Marshal() (dAtA []byte, err error) {
@ -357,10 +355,10 @@ func (m *Interface) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x3a
}
if len(m.PciAddr) > 0 {
i -= len(m.PciAddr)
copy(dAtA[i:], m.PciAddr)
i = encodeVarintTypes(dAtA, i, uint64(len(m.PciAddr)))
if len(m.PciPath) > 0 {
i -= len(m.PciPath)
copy(dAtA[i:], m.PciPath)
i = encodeVarintTypes(dAtA, i, uint64(len(m.PciPath)))
i--
dAtA[i] = 0x32
}
@ -591,7 +589,7 @@ func (m *Interface) Size() (n int) {
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
l = len(m.PciAddr)
l = len(m.PciPath)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
@ -703,7 +701,7 @@ func (this *Interface) String() string {
`IPAddresses:` + repeatedStringForIPAddresses + `,`,
`Mtu:` + fmt.Sprintf("%v", this.Mtu) + `,`,
`HwAddr:` + fmt.Sprintf("%v", this.HwAddr) + `,`,
`PciAddr:` + fmt.Sprintf("%v", this.PciAddr) + `,`,
`PciPath:` + fmt.Sprintf("%v", this.PciPath) + `,`,
`Type:` + fmt.Sprintf("%v", this.Type) + `,`,
`RawFlags:` + fmt.Sprintf("%v", this.RawFlags) + `,`,
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
@ -1066,7 +1064,7 @@ func (m *Interface) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PciAddr", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field PciPath", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@ -1094,7 +1092,7 @@ func (m *Interface) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PciAddr = string(dAtA[iNdEx:postIndex])
m.PciPath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 7:
if wireType != 2 {

View File

@ -850,7 +850,7 @@ func (s *Sandbox) AddInterface(inf *pbTypes.Interface) (*pbTypes.Interface, erro
}
// Add network for vm
inf.PciAddr = endpoint.PciAddr()
inf.PciPath = endpoint.PciAddr()
return s.agent.updateInterface(inf)
}