From 75d51950c92bd6536dd062be7465af3f9ad1fc8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 Dec 2023 20:26:49 +0100 Subject: [PATCH 1/4] Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#1057) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0. - [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 8d5390785..3bd717675 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 github.com/mattn/goveralls v0.0.11 github.com/stretchr/testify v1.8.1 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.17.0 golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 libvirt.org/go/libvirtxml v1.8009.0 ) @@ -65,8 +65,8 @@ require ( github.com/zclconf/go-cty v1.12.1 // indirect golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.6.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect diff --git a/go.sum b/go.sum index b1f7b4be1..951fb4305 100644 --- a/go.sum +++ b/go.sum @@ -436,8 +436,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -570,11 +570,11 @@ golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -582,8 +582,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From 7584609b3ccc2ebd423c4f989328ca9493525f2e Mon Sep 17 00:00:00 2001 From: Catalin Muresan Date: Thu, 28 Dec 2023 13:14:05 +0000 Subject: [PATCH 2/4] feat: added or data sources to extract node and device information (#1042) --- .../data_source_libvirt_node_device_info.go | 750 ++++++++++++++++++ ...ta_source_libvirt_node_device_info_test.go | 40 + libvirt/data_source_libvirt_node_devices.go | 73 ++ .../data_source_libvirt_node_devices_test.go | 41 + libvirt/data_source_libvirt_node_info.go | 94 +++ libvirt/data_source_libvirt_node_info_test.go | 35 + libvirt/provider.go | 3 + website/docs/d/node_device_info.html.markdown | 89 +++ website/docs/d/node_devices.html.markdown | 33 + website/docs/d/node_info.html.markdown | 35 + website/docs/data_sources.html.markdown | 9 + website/docs/toc.html.markdown | 1 + website/libvirt.erb | 15 + 13 files changed, 1218 insertions(+) create mode 100644 libvirt/data_source_libvirt_node_device_info.go create mode 100644 libvirt/data_source_libvirt_node_device_info_test.go create mode 100644 libvirt/data_source_libvirt_node_devices.go create mode 100644 libvirt/data_source_libvirt_node_devices_test.go create mode 100644 libvirt/data_source_libvirt_node_info.go create mode 100644 libvirt/data_source_libvirt_node_info_test.go create mode 100644 website/docs/d/node_device_info.html.markdown create mode 100644 website/docs/d/node_devices.html.markdown create mode 100644 website/docs/d/node_info.html.markdown create mode 100644 website/docs/data_sources.html.markdown diff --git a/libvirt/data_source_libvirt_node_device_info.go b/libvirt/data_source_libvirt_node_device_info.go new file mode 100644 index 000000000..d72d0346d --- /dev/null +++ b/libvirt/data_source_libvirt_node_device_info.go @@ -0,0 +1,750 @@ +package libvirt + +import ( + "encoding/xml" + "fmt" + "log" + "strconv" + + "github.com/dmacvicar/terraform-provider-libvirt/libvirt/helper/hashcode" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +// strutures to parse device XML just enough to get Capability.Type. +type DeviceGeneric struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Capability xml.Name `xml:"capability"` + Type string `xml:"type,attr"` + } `xml:"capability"` +} + +type DeviceSystem struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Product string `xml:"product"` + Hardware struct { + Vendor string `xml:"vendor"` + Version string `xml:"version"` + Serial string `xml:"serial"` + UUID string `xml:"uuid"` + } `xml:"hardware"` + Firmware struct { + Vendor string `xml:"vendor"` + Version string `xml:"version"` + ReleaseDate string `xml:"release_date"` + } `xml:"firmware"` + } `xml:"capability"` +} + +type DevicePCI struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Class string `xml:"class"` + Domain int `xml:"domain"` + Bus int `xml:"bus"` + Slot int `xml:"slot"` + Function int `xml:"function"` + Product struct { + Name string `xml:",chardata"` + ID string `xml:"id,attr"` + } `xml:"product"` + Vendor struct { + Name string `xml:",chardata"` + ID string `xml:"id,attr"` + } `xml:"vendor"` + IommuGroup struct { + IommuGroup xml.Name `xml:"iommuGroup"` + Number int `xml:"number,attr"` + Addresses []struct { + Address xml.Name `xml:"address"` + Domain string `xml:"domain,attr"` + Bus string `xml:"bus,attr"` + Slot string `xml:"slot,attr"` + Function string `xml:"function,attr"` + } `xml:"address"` + } `xml:"iommuGroup"` + } `xml:"capability"` +} + +type DeviceUSBDevice struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Bus string `xml:"bus"` + Device string `xml:"device"` + Product struct { + Name string `xml:",chardata"` + ID string `xml:"id,attr"` + } `xml:"product"` + Vendor struct { + Name string `xml:",chardata"` + ID string `xml:"id,attr"` + } `xml:"vendor"` + } `xml:"capability"` +} + +type DeviceUSB struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Number int `xml:"number"` + Class int `xml:"class"` + Subclass int `xml:"subclass"` + Protocol int `xml:"protocol"` + Description string `xml:"description"` + } `xml:"capability"` +} + +type DeviceNet struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Interface string `xml:"interface"` + Address string `xml:"address"` + Link struct { + Speed string `xml:"speed,attr"` + State string `xml:"state,attr"` + } `xml:"link"` + Feature struct { + Name []string `xml:"name,attr"` + } `xml:"feature"` + Cappability struct { + Type string `xml:"type,attr"` + } `xml:"capability"` + } `xml:"capability"` +} + +type DeviceSCSI struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Host int `xml:"host"` + Bus int `xml:"bus"` + Target int `xml:"target"` + Lun int `xml:"lun"` + ScsiType string `xml:"type"` + } `xml:"capability"` +} + +type DeviceSCSIHost struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Host int `xml:"host"` + UniqueID int `xml:"unique_id"` + } `xml:"capability"` +} + +type DeviceStorage struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Capability struct { + Type string `xml:"type,attr"` + Block string `xml:"block"` + DriveType string `xml:"drive_type"` + Model string `xml:"model"` + Serial string `xml:"serial"` + Size int `xml:"size"` + LogicalBlockSize int `xml:"logical_block_size"` + NumBlocks int `xml:"num_blocks"` + } `xml:"capability"` +} + +type DeviceDRM struct { + Device xml.Name `xml:"device"` + Name string `xml:"name"` + Path string `xml:"path"` + Parent string `xml:"parent"` + Devnode []struct { + Type string `xml:"type,attr"` + Path string `xml:",chardata"` + } `xml:"devnode"` + Capability struct { + Type string `xml:"type,attr"` + DRMType string `xml:"type"` + } `xml:"capability"` +} + +// a libvirt nodeinfo datasource +// +// Datasource example: +// +// data "libvirt_node_device_info" "info" { +// } +// +// output "xml" { +// value = data.libvirt_node_device_info.info.xml +// } +func datasourceLibvirtNodeDeviceInfo() *schema.Resource { + return &schema.Resource{ + Read: resourceLibvirtNodeDeviceInfoRead, + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + }, + "path": { + Type: schema.TypeString, + Computed: true, + }, + "parent": { + Type: schema.TypeString, + Computed: true, + }, + "xml": { + Type: schema.TypeString, + Computed: true, + }, + "devnode": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { // drm + Type: schema.TypeString, + Computed: true, + }, + "path": { // drm + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "capability": { + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "class": { // pci, usb + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "domain": { // pci + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "bus": { // pci, usb_device + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "slot": { // pci + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "function": { // pci + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "block": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "drive_type": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "model": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "serial": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "size": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "logical_block_size": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "num_blocks": { // storage + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "hardware": { // system + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "firmware": { // system + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "product": { // pci, system, usb_device + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "vendor": { // pci, usb_device + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "iommu_group": { // pci + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "number": { + Type: schema.TypeString, + Computed: true, + }, + "addresses": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeMap, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + }, + }, + }, + "device": { // usb_device + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "number": { // usb + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "subclass": { // usb + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "protocol": { // usb + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "description": { // usb + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "interface": { // net + Type: schema.TypeString, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "address": { // net + Type: schema.TypeString, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "link": { // net + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "capability": { // net + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "features": { // net + Type: schema.TypeList, + Optional: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "host": { // scsi, scsi_host + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "target": { // scsi + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "lun": { // scsi + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "scsi_type": { // scsi + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "unique_id": { // scsi_host + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "drm_type": { // drm + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func resourceLibvirtNodeDeviceInfoRead(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] Read data source libvirt_nodedevices") + + virConn := meta.(*Client).libvirt + if virConn == nil { + return fmt.Errorf(LibVirtConIsNil) + } + + var deviceName string + + if name, ok := d.GetOk("name"); ok { + deviceName = name.(string) + log.Printf("[DEBUG] Got name: %s", deviceName) + } + + device, err := virConn.NodeDeviceLookupByName(deviceName) + if err != nil { + return fmt.Errorf("failed to lookup node device: %w", err) + } + + xmlDesc, err := virConn.NodeDeviceGetXMLDesc(device.Name, 0) + if err != nil { + return fmt.Errorf("failed to get XML for node device: %w", err) + } + + deviceXML := DeviceGeneric{} + capability := []map[string]interface{}{} + + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device generic into deviceXML: %#v", deviceXML) + + switch deviceXML.Capability.Type { + ////////////////// SYSTEM ////////////////// + case "system": + deviceXML := DeviceSystem{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device system XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device system into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + // clash with pci.product which is a map, converted to map + "product": map[string]interface{}{ + "name": deviceXML.Capability.Product, + }, + "hardware": map[string]interface{}{ + "vendor": deviceXML.Capability.Hardware.Vendor, + "version": deviceXML.Capability.Hardware.Version, + "serial": deviceXML.Capability.Hardware.Serial, + "uuid": deviceXML.Capability.Hardware.UUID, + }, + "firmware": map[string]interface{}{ + "vendor": deviceXML.Capability.Firmware.Vendor, + "version": deviceXML.Capability.Firmware.Version, + "release_date": deviceXML.Capability.Firmware.ReleaseDate, + }, + } + + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type system to : %v", capability) + + ///////////////// PCI ////////////////// + case "pci": + deviceXML := DevicePCI{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device pci XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device pci into deviceXML: %v", deviceXML) + + iommuGroup := []map[string]interface{}{} + addresses := []map[string]interface{}{} + + for _, v := range deviceXML.Capability.IommuGroup.Addresses { + m := map[string]interface{}{ + "domain": v.Domain, + "bus": v.Bus, + "slot": v.Slot, + "function": v.Function, + } + addresses = append(addresses, m) + } + + ig := map[string]interface{}{ + "number": fmt.Sprintf("%d", deviceXML.Capability.IommuGroup.Number), + "addresses": addresses, + } + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "class": deviceXML.Capability.Class, + "domain": fmt.Sprintf("%d", deviceXML.Capability.Domain), + "bus": fmt.Sprintf("%d", deviceXML.Capability.Bus), + "slot": fmt.Sprintf("%d", deviceXML.Capability.Slot), + "function": fmt.Sprintf("%d", deviceXML.Capability.Function), + "product": map[string]interface{}{ + "id": deviceXML.Capability.Product.ID, + "name": deviceXML.Capability.Product.Name, + }, + "vendor": map[string]interface{}{ + "id": deviceXML.Capability.Vendor.ID, + "name": deviceXML.Capability.Vendor.Name, + }, + "iommu_group": append(iommuGroup, ig), + } + log.Printf("[DEBUG] iommuGroup device type pci to : %v", deviceXML.Capability.IommuGroup.Addresses) + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type pci to : %v", capability) + + ////////////////// USB Device ////////////////// + case "usb_device": + deviceXML := DeviceUSBDevice{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device usb_device XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device usb_device into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "bus": deviceXML.Capability.Bus, + "device": deviceXML.Capability.Device, + "product": map[string]interface{}{ + "id": deviceXML.Capability.Product.ID, + "name": deviceXML.Capability.Product.Name, + }, + "vendor": map[string]interface{}{ + "id": deviceXML.Capability.Vendor.ID, + "name": deviceXML.Capability.Vendor.Name, + }, + } + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type usb_device to : %v", capability) + + ////////////////// USB Host ////////////////// + case "usb": + deviceXML := DeviceUSB{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device usb XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device usb into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "number": fmt.Sprintf("%d", deviceXML.Capability.Number), + "class": fmt.Sprintf("%d", deviceXML.Capability.Class), + "subclass": fmt.Sprintf("%d", deviceXML.Capability.Subclass), + "protocol": fmt.Sprintf("%d", deviceXML.Capability.Protocol), + "description": deviceXML.Capability.Description, + } + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type usb to : %v", capability) + + ////////////////// STORAGE ////////////////// + case "storage": + deviceXML := DeviceStorage{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device storage XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device storage into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "block": deviceXML.Capability.Block, + "drive_type": deviceXML.Capability.DriveType, + "model": deviceXML.Capability.Model, + "serial": deviceXML.Capability.Serial, + "size": fmt.Sprintf("%d", deviceXML.Capability.Size), + "logical_block_size": fmt.Sprintf("%d", deviceXML.Capability.LogicalBlockSize), + "num_blocks": fmt.Sprintf("%d", deviceXML.Capability.NumBlocks), + } + + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type storage to : %v", capability) + + ////////////////// NET ////////////////// + case "net": + deviceXML := DeviceNet{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device net XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device net into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "interface": deviceXML.Capability.Interface, + "address": deviceXML.Capability.Address, + "link": map[string]interface{}{ + "speed": deviceXML.Capability.Link.Speed, + "state": deviceXML.Capability.Link.State, + }, + "features": deviceXML.Capability.Feature.Name, + "capability": map[string]interface{}{ + "type": deviceXML.Capability.Cappability.Type, + }, + } + + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type net to : %v", capability) + + ////////////////// SCSI ////////////////// + case "scsi": + deviceXML := DeviceSCSI{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device scsi XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device scsi into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "host": fmt.Sprintf("%d", deviceXML.Capability.Host), + "bus": fmt.Sprintf("%d", deviceXML.Capability.Bus), + "target": fmt.Sprintf("%d", deviceXML.Capability.Target), + "lun": fmt.Sprintf("%d", deviceXML.Capability.Lun), + "scsi_type": deviceXML.Capability.ScsiType, + } + + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type scsi to : %v", capability) + + ////////////////// SCSI Host ////////////////// + case "scsi_host": + deviceXML := DeviceSCSIHost{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device scsi_host XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device scsi_host into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "host": fmt.Sprintf("%d", deviceXML.Capability.Host), + "unique_id": fmt.Sprintf("%d", deviceXML.Capability.UniqueID), + } + + capability = append(capability, c) + log.Printf("[DEBUG] Set capability type scsi_host to : %v", capability) + + ////////////////// SCSI Host ////////////////// + case "drm": + deviceXML := DeviceDRM{} + err = xml.Unmarshal([]byte(xmlDesc), &deviceXML) + if err != nil { + log.Fatalf("failed to unmarshal device drm XML into deviceXML: %v", err) + } + log.Printf("[DEBUG] Parsed device drm into deviceXML: %v", deviceXML) + + c := map[string]interface{}{ + "type": deviceXML.Capability.Type, + "drm_type": deviceXML.Capability.DRMType, + } + + capability = append(capability, c) + + devnode := []map[string]interface{}{} + for _, v := range deviceXML.Devnode { + m := map[string]interface{}{ + "type": v.Type, + "path": v.Path, + } + devnode = append(devnode, m) + } + + log.Printf("[DEBUG] Set capability type drm to : %v", capability) + d.Set("devnode", devnode) + log.Printf("[DEBUG] Set devnode type drm to : %v", deviceXML.Devnode) + + default: + return fmt.Errorf("unknown device capability type: %v", deviceXML.Capability.Type) + } + + d.Set("xml", xmlDesc) + d.Set("path", deviceXML.Path) + d.Set("parent", deviceXML.Parent) + log.Printf("[DEBUG] d.Set capability type %s : %s", capability[0]["type"], capability) + d.Set("capability", capability) + d.SetId(strconv.Itoa(hashcode.String(fmt.Sprintf("%v", xmlDesc)))) + + return nil +} diff --git a/libvirt/data_source_libvirt_node_device_info_test.go b/libvirt/data_source_libvirt_node_device_info_test.go new file mode 100644 index 000000000..9eaaf68b9 --- /dev/null +++ b/libvirt/data_source_libvirt_node_device_info_test.go @@ -0,0 +1,40 @@ +package libvirt + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccLibvirtNodeDeviceInfoDataSource(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceNodeDeviceInfoPCI, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.libvirt_node_device_info.device", "name", regexp.MustCompile(`^pci_0000_00_00_0$`)), + ), + }, { + Config: testAccDataSourceNodeDeviceInfoSystem, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.libvirt_node_device_info.device", "name", regexp.MustCompile(`^computer$`)), + ), + }, + }, + }) +} + +const testAccDataSourceNodeDeviceInfoPCI = ` +data "libvirt_node_device_info" "device" { + name = "pci_0000_00_00_0" +}` + +const testAccDataSourceNodeDeviceInfoSystem = ` +data "libvirt_node_device_info" "device" { + name = "computer" +}` diff --git a/libvirt/data_source_libvirt_node_devices.go b/libvirt/data_source_libvirt_node_devices.go new file mode 100644 index 000000000..0f8339ac2 --- /dev/null +++ b/libvirt/data_source_libvirt_node_devices.go @@ -0,0 +1,73 @@ +package libvirt + +import ( + "fmt" + "log" + "sort" + "strconv" + + libvirt "github.com/digitalocean/go-libvirt" + "github.com/dmacvicar/terraform-provider-libvirt/libvirt/helper/hashcode" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +// a libvirt nodeinfo datasource +// +// Datasource example: +// +// data "libvirt_node_devices" "list" { +// } +// +// output "cpus" { +// value = data.libvirt_node_devices.list.devices +// } +func datasourceLibvirtNodeDevices() *schema.Resource { + return &schema.Resource{ + Read: resourceLibvirtNodeDevicesRead, + Schema: map[string]*schema.Schema{ + "capability": { + Type: schema.TypeString, + Optional: true, + }, + "devices": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + }, + } +} + +func resourceLibvirtNodeDevicesRead(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] Read data source libvirt_nodedevices") + + virConn := meta.(*Client).libvirt + if virConn == nil { + return fmt.Errorf(LibVirtConIsNil) + } + + var cap libvirt.OptString + + if capability, ok := d.GetOk("capability"); ok { + cap = append(cap, capability.(string)) + log.Printf("[DEBUG] Got capability: %v", cap) + } + + rnum, err := virConn.NodeNumOfDevices(libvirt.OptString(cap), 0) + if err != nil { + return fmt.Errorf("failed to retrieve number of devices: %w", err) + } + + devices, err := virConn.NodeListDevices(cap, rnum, 0) + if err != nil { + return fmt.Errorf("failed to retrieve list of node devices: %w", err) + } + + sort.Strings(devices) + d.Set("devices", devices) + d.SetId(strconv.Itoa(hashcode.String(fmt.Sprintf("%v", devices)))) + + return nil +} diff --git a/libvirt/data_source_libvirt_node_devices_test.go b/libvirt/data_source_libvirt_node_devices_test.go new file mode 100644 index 000000000..3f12b3707 --- /dev/null +++ b/libvirt/data_source_libvirt_node_devices_test.go @@ -0,0 +1,41 @@ +package libvirt + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccLibvirtNodeDevicesDataSource(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceNodeDevicesPci, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.libvirt_node_devices.node", "devices[0]", regexp.MustCompile(`^pci_\d{4}_\d{2}_\d{2}_\d{1}`)), + ), + }, + { + Config: testAccDataSourceNodeDevicesSystem, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.libvirt_node_devices.node", "devices[0]", regexp.MustCompile(`^computer$`)), + ), + }, + }, + }) +} + +const testAccDataSourceNodeDevicesPci = ` +data "libvirt_node_devices" "node" { + capability = "pci" +}` + +const testAccDataSourceNodeDevicesSystem = ` +data "libvirt_node_devices" "node" { + capability = "system" +}` diff --git a/libvirt/data_source_libvirt_node_info.go b/libvirt/data_source_libvirt_node_info.go new file mode 100644 index 000000000..36ee8b9f9 --- /dev/null +++ b/libvirt/data_source_libvirt_node_info.go @@ -0,0 +1,94 @@ +package libvirt + +import ( + "fmt" + "log" + "strconv" + + "github.com/dmacvicar/terraform-provider-libvirt/libvirt/helper/hashcode" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +// a libvirt nodeinfo datasource +// +// Datasource example: +// +// data "libvirt_nodeinfo" "info" { +// } +// +// output "cpus" { +// value = data.libvirt_nodeinfo.info.cpus +// } +func datasourceLibvirtNodeInfo() *schema.Resource { + return &schema.Resource{ + Read: resourceLibvirtNodeInfoRead, + Schema: map[string]*schema.Schema{ + "cpu_model": { + Type: schema.TypeString, + Computed: true, + }, + "memory_total_kb": { + Type: schema.TypeInt, + Computed: true, + }, + "cpu_cores_total": { + Type: schema.TypeInt, + Computed: true, + }, + "numa_nodes": { + Type: schema.TypeInt, + Computed: true, + }, + "cpu_sockets": { + Type: schema.TypeInt, + Computed: true, + }, + "cpu_cores_per_socket": { + Type: schema.TypeInt, + Computed: true, + }, + "cpu_threads_per_core": { + Type: schema.TypeInt, + Computed: true, + }, + }, + } +} + +func resourceLibvirtNodeInfoRead(d *schema.ResourceData, meta interface{}) error { + log.Printf("[DEBUG] Read data source libvirt_nodeinfo") + + virConn := meta.(*Client).libvirt + if virConn == nil { + return fmt.Errorf(LibVirtConIsNil) + } + + model, memory, cpus, _, nodes, sockets, cores, threads, err := virConn.NodeGetInfo() + + if err != nil { + return fmt.Errorf("failed to retrieve domains: %w", err) + } + + d.Set("cpu_model", int8ToString(model)) + d.Set("cpu_cores_total", cpus) + d.Set("cpu_cores_per_socket", cores) + d.Set("numa_nodes", nodes) + d.Set("cpu_sockets", sockets) + d.Set("cpu_threads_per_core", threads) + d.Set("numa_nodes", nodes) + d.Set("memory_total_kb", memory) + d.SetId(strconv.Itoa(hashcode.String(fmt.Sprintf("%v%v%v%v%v%v%v", model, memory, cpus, nodes, sockets, cores, threads)))) + + return nil +} + +func int8ToString(bs [32]int8) string { + ba := []uint8{} + for _, b := range bs { + if b == 0 { + break + } + ba = append(ba, uint8(b)) + } + return string(ba) +} diff --git a/libvirt/data_source_libvirt_node_info_test.go b/libvirt/data_source_libvirt_node_info_test.go new file mode 100644 index 000000000..20eed1c59 --- /dev/null +++ b/libvirt/data_source_libvirt_node_info_test.go @@ -0,0 +1,35 @@ +package libvirt + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccLibvirtNodeInfoDataSource(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceNodeInfo, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.libvirt_node_info.info", "cpus", regexp.MustCompile(`^\d+`)), + ), + }, { + Config: testAccDataSourceNodeInfo, + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.libvirt_node_info.info", "numa_nodes", regexp.MustCompile(`^\d+`)), + ), + }, + }, + }) +} + +const testAccDataSourceNodeInfo = ` +data "libvirt_node_info" "info" { + +}` diff --git a/libvirt/provider.go b/libvirt/provider.go index 81bb05d03..f7720138a 100644 --- a/libvirt/provider.go +++ b/libvirt/provider.go @@ -31,6 +31,9 @@ func Provider() *schema.Provider { "libvirt_network_dns_host_template": datasourceLibvirtNetworkDNSHostTemplate(), "libvirt_network_dns_srv_template": datasourceLibvirtNetworkDNSSRVTemplate(), "libvirt_network_dnsmasq_options_template": datasourceLibvirtNetworkDnsmasqOptionsTemplate(), + "libvirt_node_info": datasourceLibvirtNodeInfo(), + "libvirt_node_device_info": datasourceLibvirtNodeDeviceInfo(), + "libvirt_node_devices": datasourceLibvirtNodeDevices(), }, ConfigureFunc: providerConfigure, diff --git a/website/docs/d/node_device_info.html.markdown b/website/docs/d/node_device_info.html.markdown new file mode 100644 index 000000000..495b73cd5 --- /dev/null +++ b/website/docs/d/node_device_info.html.markdown @@ -0,0 +1,89 @@ +--- +layout: "libvirt" +page_title: "Libvirt: libvirt_node_device_info" +sidebar_current: "docs-libvirt-node-device-info" +description: |- + Use this data source to get information about a specific device on the current node +--- + +# Data Source: libvirt\_node\_device\_info + +Retrieve information about a specific device on the current node + +## Example Usage + +```hcl +data "libvirt_node_device_info" "device" { + name = "pci_0000_00_00_0" +} +``` + +## Argument Reference + +* `name` - (Required) The name of the device name as expected by [libvirt](https://www.libvirt.org/manpages/virsh.html#nodedev-commands). + +## Attribute Reference + +This data source exports the following attributes in addition to the arguments above: + +* `capability` - A map of the various attributes for the device, depending on the type of device. + Currently implemented are `pci`, `storage`, `usb` + * `type` - Device type: `pci`, `storage`, `usb` + * `devnode`: For devices with a `/dev` special file. A mandatory attribute type specify the kind of file `path`, which may be either dev for the main name, or `link` for additional symlinks. + + For `pci` devices the additional attributes are: + * `class` - Device PCI class + * `domain` - Device PCI domain + * `bus` - Device PCI bus + * `slot` - Device PCI slot + * `function` - Device PCI function + * `product` - Device PCI product map of `id` and `name` + * `vendor` - Device PCI vendor map of `id` and `name` + * `iommu_group` - Structure that holds IOMMU Group `number` and the list of devices that are part of the group + + For `storage` devices the additional attributes are: + * `block` - Block device name + * `drive_type` - Device drive type + * `model` - Device model + * `serial` - Device serial number + * `size` - Device size in bytes + * `logical_block_size` - Device logical block size + * `num_blocks` - Number of blocks on the device + + For `usb` devices the additional attributes are: + * `number` - Device number + * `class` - Device class + * `subclass` - Device subclass + * `protocol` - Device protocol + + For `usb_device` devices the additional attributes are: + * `bus` - Which bus the device belongs to + * `device` - Which device within the \ + * `product` - If present, the product `id` and `name` from the device ROM + * `vendor` - If present, the vendor `id` and `name` from the device ROM + + For `net` devices the additional attributes are: + * `interface` - The interface name tied to this device + * `address` - If present, the MAC address of the device + * `link` - Optional to reflect the status of the link via `speed` and `state` keys + * `feature` - List of features supported by the network interface + * `capability` - Holds key `type` that describes the type of network interface: `80203` for IEEE 802.3 or `80211` for IEEE 802.11 + + For `scsi_host` devices the additional attributes are: + * `host` - The SCSI host number + * `unique_id` - This optionally provides the value from the 'unique_id' file found in the scsi_host's directory + + For `scsi` devices the additional attributes are: + * `host` - The SCSI host containing the device + * `bus` - The bus within the host + * `target` - The target within the bus + * `lun` - The lun within the target + * `scsi_type` - The type of SCSI device + + For `drm` devices the additional attributes are: + * `drm_type` - Type of DRM device: `render` or `card` + +* `parent` - The parent of this device in the hierarchy +* `path` - Full path of the device +* `xml` - The XML returned by the libvirt API call +* `devnode` - For type `drm` holds the `path` and `link` that point to the device diff --git a/website/docs/d/node_devices.html.markdown b/website/docs/d/node_devices.html.markdown new file mode 100644 index 000000000..566f8568a --- /dev/null +++ b/website/docs/d/node_devices.html.markdown @@ -0,0 +1,33 @@ +--- +layout: "libvirt" +page_title: "Libvirt: libvirt_node_devices" +sidebar_current: "docs-libvirt-node-devices" +description: |- + Use this data source to get information about the devices present on current node +--- + +# Data Source: libvirt\_node\_devices + +Retrieve information about the devices present on the current node + +## Example Usage + +```hcl +data "libvirt_node_devices" "node" { + capability = "pci" +} +``` + +## Argument Reference + +* `capability` - (Optional) The type of device, used to filter the output by capability type. + Can be one of `system`, `pci`, `usb_device`, `usb`, `net`, `scsi_host`, + `scsi_target`, `scsi`, `storage`, `fc_host`, `vports`, `scsi_generic`, `drm`, + `mdev`, `mdev_types`, `ccw`, `css`, `ap_card`, `ap_queue`, `ap_matrix`. + Defaults to all active devices. + +## Attribute Reference + +This data source exports the following attributes in addition to the arguments above: + +* `devices` - A list of devices that match the selected capability diff --git a/website/docs/d/node_info.html.markdown b/website/docs/d/node_info.html.markdown new file mode 100644 index 000000000..c965e7ac3 --- /dev/null +++ b/website/docs/d/node_info.html.markdown @@ -0,0 +1,35 @@ +--- +layout: "libvirt" +page_title: "Libvirt: libvirt_node_info" +sidebar_current: "docs-libvirt-node-info" +description: |- + Use this data source to get information about the current node +--- + +# Data Source: libvirt\_node\_info + +Retrieve information about the current node + +## Example Usage + +```hcl +data "libvirt_node_info" "node" { + +} +``` + +## Argument Reference + +This data source has no arguments. + +## Attribute Reference + +This data source exports the following attributes in addition to the arguments above: + +* `cpu_cores_per_socket` - Number of CPU cores per each socket +* `cpu_cores_total` - Number of CPU cores in total +* `cpu_model` - CPU Architecture, usually `x86_64` +* `cpu_sockets` - How many CPU sockets are present +* `cpu_threads_per_core` - How many CPU Threads are available per each CPU core +* `memory_total_kb` - The amount of memory installed, in KiB +* `numa_nodes` - How many NUMA nodes/cells are available. diff --git a/website/docs/data_sources.html.markdown b/website/docs/data_sources.html.markdown new file mode 100644 index 000000000..5c1fbc25f --- /dev/null +++ b/website/docs/data_sources.html.markdown @@ -0,0 +1,9 @@ + +# Data Sources + +```eval_rst +.. toctree:: + :glob: + + d/** +``` diff --git a/website/docs/toc.html.markdown b/website/docs/toc.html.markdown index 5fe1fef79..66bf41cb6 100644 --- a/website/docs/toc.html.markdown +++ b/website/docs/toc.html.markdown @@ -11,4 +11,5 @@ :maxdepth: 2 resources + data_sources ``` diff --git a/website/libvirt.erb b/website/libvirt.erb index bdfaa8c56..fbf6e288d 100644 --- a/website/libvirt.erb +++ b/website/libvirt.erb @@ -30,6 +30,21 @@ + > + Data Sources + + + <% end %> From 36f3de0492028ccf012bd99d4de5a7eb780300ef Mon Sep 17 00:00:00 2001 From: Mike Beaumont Date: Thu, 28 Dec 2023 14:31:09 +0100 Subject: [PATCH 3/4] ci: upgrade golangci-lint in workflows (#1061) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9a0ca221..80dfd02ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.52.2 + version: v1.55.2 only-new-issues: true build: name: Build From 8ce864fb071fb1969168ff509bd2d2c22306728d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Dec 2023 14:32:48 +0100 Subject: [PATCH 4/4] Bump google.golang.org/grpc from 1.51.0 to 1.56.3 (#1043) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.51.0 to 1.56.3. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.51.0...v1.56.3) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 3bd717675..1c2835929 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/coreos/ignition/v2 v2.14.0 // indirect github.com/coreos/vcontext v0.0.0-20211021162308-f1dbbca7bef4 // indirect github.com/fatih/color v1.13.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect @@ -69,9 +69,9 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.6.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect - google.golang.org/grpc v1.51.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect + google.golang.org/grpc v1.56.3 // indirect + google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 951fb4305..5701e1e89 100644 --- a/go.sum +++ b/go.sum @@ -158,8 +158,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -690,8 +690,8 @@ google.golang.org/genproto v0.0.0-20200608115520-7c474a2e3482/go.mod h1:jDfRM7Fc google.golang.org/genproto v0.0.0-20200610104632-a5b850bcf112/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= +google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= @@ -705,8 +705,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= +google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -719,8 +719,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=