diff --git a/Makefile b/Makefile index cd83ed47bf3d..e74f6d7a3ba9 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ TAG_SQLITE3=$(shell printf "$(HASH)include \nvoid main(){dqlite_node_i GOPATH ?= $(shell go env GOPATH) CGO_LDFLAGS_ALLOW ?= (-Wl,-wrap,pthread_create)|(-Wl,-z,now) SPHINXENV=doc/.sphinx/venv/bin/activate -GOMIN=1.22.0 +GOMIN=1.22.7 ifneq "$(wildcard vendor)" "" DQLITE_PATH=$(CURDIR)/vendor/dqlite @@ -76,7 +76,7 @@ ifneq "$(LXD_OFFLINE)" "" @echo "The update-gomod target cannot be run in offline mode." exit 1 endif - go get -t -v -d -u ./... + go get -t -v -u ./... go get github.com/mdlayher/socket@v0.4.1 go get github.com/digitalocean/go-libvirt@v0.0.0-20221205150000-2939327a8519 go get github.com/jaypipes/pcidb@v1.0.0 @@ -235,7 +235,12 @@ update-po: set -eu; \ for lang in $(LINGUAS); do\ msgmerge --backup=none -U $$lang.po po/$(DOMAIN).pot; \ - done + done; \ + if [ -t 0 ] && ! git diff --quiet -- po/*.po; then \ + read -rp "Would you like to commit i18n changes (Y/n)? " answer; \ + if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \ + git commit -sm "i18n: Update translations." -- po/*.po; fi; \ + fi .PHONY: update-pot update-pot: @@ -243,6 +248,12 @@ ifeq "$(LXD_OFFLINE)" "" (cd / ; go install github.com/snapcore/snapd/i18n/xgettext-go@2.57.1) endif xgettext-go -o po/$(DOMAIN).pot --add-comments-tag=TRANSLATORS: --sort-output --package-name=$(DOMAIN) --msgid-bugs-address=lxd@lists.canonical.com --keyword=i18n.G --keyword-plural=i18n.NG lxc/*.go lxc/*/*.go + if git diff --quiet --ignore-matching-lines='^\s*"POT-Creation-Date: .*\n"' -- po/*.pot; then git checkout -- po/*.pot; fi + if [ -t 0 ] && ! git diff --quiet --ignore-matching-lines='^\s*"POT-Creation-Date: .*\n"' -- po/*.pot; then \ + read -rp "Would you like to commit i18n template changes (Y/n)? " answer; \ + if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \ + git commit -sm "i18n: Update translation templates." -- po/*.pot; fi; \ + fi .PHONY: build-mo build-mo: $(MOFILES) diff --git a/doc/requirements.md b/doc/requirements.md index 4e4dac82e31a..fdac3a6fa512 100644 --- a/doc/requirements.md +++ b/doc/requirements.md @@ -3,7 +3,7 @@ (requirements-go)= ## Go -LXD requires Go 1.22.0 or higher and is only tested with the Golang compiler. +LXD requires Go 1.22.7 or higher and is only tested with the Golang compiler. We recommend having at least 2GB of RAM to allow the build to complete. diff --git a/doc/rest-api.yaml b/doc/rest-api.yaml index 2ae76c2b0842..7492a223e50e 100644 --- a/doc/rest-api.yaml +++ b/doc/rest-api.yaml @@ -973,7 +973,7 @@ definitions: x-go-name: Protocol server: description: URL of the source server - example: https://cloud-images.ubuntu.com/releases + example: https://cloud-images.ubuntu.com/releases/ type: string x-go-name: Server type: object @@ -1088,7 +1088,7 @@ definitions: x-go-name: Secret server: description: URL of the source server - example: https://cloud-images.ubuntu.com/releases + example: https://cloud-images.ubuntu.com/releases/ type: string x-go-name: Server type: @@ -2069,7 +2069,7 @@ definitions: x-go-name: Websockets server: description: Remote server URL (for remote images) - example: https://cloud-images.ubuntu.com/releases + example: https://cloud-images.ubuntu.com/releases/ type: string x-go-name: Server source: diff --git a/go.mod b/go.mod index c024bd481521..889ff071bb40 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/canonical/lxd -go 1.22.0 +go 1.22.7 // https://github.com/minio/minio-go/issues/1931 replace github.com/minio/minio-go/v7 => github.com/minio/minio-go/v7 v7.0.66 @@ -35,10 +35,10 @@ require ( github.com/mdlayher/netx v0.0.0-20230430222610-7e21880baee8 github.com/mdlayher/vsock v1.2.1 github.com/miekg/dns v1.1.62 - github.com/minio/minio-go/v7 v7.0.76 + github.com/minio/minio-go/v7 v7.0.77 github.com/mitchellh/mapstructure v1.5.0 github.com/olekukonko/tablewriter v0.0.5 - github.com/osrg/gobgp/v3 v3.29.0 + github.com/osrg/gobgp/v3 v3.30.0 github.com/pkg/sftp v1.13.6 github.com/pkg/xattr v0.4.10 github.com/robfig/cron/v3 v3.0.1 @@ -57,13 +57,13 @@ require ( gopkg.in/juju/environschema.v1 v1.0.1 gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637 gopkg.in/yaml.v2 v2.4.0 - k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 + k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 ) require ( - github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da // indirect github.com/digitalocean/go-libvirt v0.0.0-20221205150000-2939327a8519 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/eapache/channels v1.1.0 // indirect @@ -89,7 +89,7 @@ require ( github.com/juju/webbrowser v1.0.0 // indirect github.com/julienschmidt/httprouter v1.3.0 // indirect github.com/k-sone/critbitgo v1.4.0 // indirect - github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.10 // indirect github.com/klauspost/cpuid/v2 v2.2.8 // indirect github.com/kr/fs v0.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect @@ -126,8 +126,8 @@ require ( golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/tools v0.25.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.66.2 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect + google.golang.org/grpc v1.67.1 // indirect gopkg.in/errgo.v1 v1.0.1 // indirect gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect gopkg.in/httprequest.v1 v1.2.1 // indirect diff --git a/go.sum b/go.sum index 031428de00cd..6207e2f76f39 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -cel.dev/expr v0.15.0 h1:O1jzfJCQBfL5BFoYktaxwIhuttaQPsVWerH9/EEKx0w= -cel.dev/expr v0.15.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= +cel.dev/expr v0.16.0 h1:yloc84fytn4zmJX2GU3TkXGsaieaV7dQ057Qs4sIG2Y= +cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -28,8 +28,8 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= -cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= -cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= +cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= +cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= @@ -81,8 +81,8 @@ github.com/cloudflare/cfssl v1.6.1/go.mod h1:ENhCj4Z17+bY2XikpxVmTHDg/C2IsG2Q0ZB github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnThWgvH2wg8376yUJmPhEH4H3kw= -github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= +github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -90,15 +90,16 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8 github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38= +github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/digitalocean/go-libvirt v0.0.0-20221205150000-2939327a8519 h1:OpkN/n40cmKenDQS+IOAeW9DLhYy4DADSeZnouCEV/E= github.com/digitalocean/go-libvirt v0.0.0-20221205150000-2939327a8519/go.mod h1:WyJJyfmJ0gWJvjV+ZH4DOgtOYZc1KOvYyBXWCLKxsUU= github.com/digitalocean/go-qemu v0.0.0-20230711162256-2e3d0186973e h1:x5PInTuXLddHWHlePCNAcM8QtUfOGx44f3UmYPMtDcI= @@ -121,11 +122,11 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155 h1:IgJPqnrlY2Mr4pYB6oaMKvFvwJ9H+X6CCY5x1vCTcpc= -github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155/go.mod h1:5Wkq+JduFtdAXihLmeTJf+tRYIT4KBc2vPXDhwVo1pA= +github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= +github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 h1:fmFk0Wt3bBxxwZnu48jqMdaOR/IZ4vdtJFuaFV8MpIE= github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3/go.mod h1:bJWSKrZyQvfTnb2OudyUjurSG4/edverV7n82+K3JiM= @@ -420,8 +421,8 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= @@ -515,8 +516,8 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/osrg/gobgp/v3 v3.29.0 h1:ISWjY5YQ45THcvXWdG2ykzXWxS22rgE6U9YWdaI/ki8= -github.com/osrg/gobgp/v3 v3.29.0/go.mod h1:ZGeSti9mURR/o5hf5R6T1FM5g1yiEBZbhP+TuqYJUpI= +github.com/osrg/gobgp/v3 v3.30.0 h1:nGCr0G4ERPeKEHw9HpaUybeZdgIdrHHIIG2VSoZR2lQ= +github.com/osrg/gobgp/v3 v3.30.0/go.mod h1:8m+kgkdaWrByxg5EWpNUO2r/mopodrNBOUBhMnW/yGQ= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= @@ -1031,10 +1032,10 @@ google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaE google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= -google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 h1:+rdxYoE3E5htTEWIe15GlN6IfvbURM//Jt0mmkmm6ZU= -google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117/go.mod h1:OimBR/bc1wPO9iV4NC2bpyjy3VnAwZh5EBPQdtaE5oo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= +google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1055,8 +1056,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= 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= @@ -1124,8 +1125,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 h1:b2FmK8YH+QEwq/Sy2uAEhmqL5nPfGYbJOcaqjeYYZoA= -k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI= +k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= launchpad.net/xmlpath v0.0.0-20130614043138-000000000004/go.mod h1:vqyExLOM3qBx7mvYRkoxjSCF945s0mbe7YynlKYXtsA= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/lxc/config/default.go b/lxc/config/default.go index 9b7c127b6a91..37d1ca2356eb 100644 --- a/lxc/config/default.go +++ b/lxc/config/default.go @@ -16,7 +16,7 @@ var ImagesRemote = Remote{ // UbuntuRemote is the Ubuntu image server (over simplestreams). var UbuntuRemote = Remote{ - Addr: "https://cloud-images.ubuntu.com/releases", + Addr: "https://cloud-images.ubuntu.com/releases/", Static: true, Public: true, Protocol: "simplestreams", @@ -24,7 +24,7 @@ var UbuntuRemote = Remote{ // UbuntuDailyRemote is the Ubuntu daily image server (over simplestreams). var UbuntuDailyRemote = Remote{ - Addr: "https://cloud-images.ubuntu.com/daily", + Addr: "https://cloud-images.ubuntu.com/daily/", Static: true, Public: true, Protocol: "simplestreams", diff --git a/lxc/export.go b/lxc/export.go index 6530799257d3..a467c4b56980 100644 --- a/lxc/export.go +++ b/lxc/export.go @@ -81,6 +81,26 @@ func (c *cmdExport) Run(cmd *cobra.Command, args []string) error { return fmt.Errorf("Create instance backup: %w", err) } + var targetName string + if len(args) > 1 { + targetName = args[1] + } else { + targetName = name + ".backup" + } + + var target *os.File + if targetName == "-" { + target = os.Stdout + c.global.flagQuiet = true + } else { + target, err = os.Create(shared.HostPathFollow(targetName)) + if err != nil { + return err + } + + defer func() { _ = target.Close() }() + } + // Watch the background operation progress := cli.ProgressRenderer{ Format: i18n.G("Backing up instance: %s"), @@ -127,26 +147,6 @@ func (c *cmdExport) Run(cmd *cobra.Command, args []string) error { } }() - var targetName string - if len(args) > 1 { - targetName = args[1] - } else { - targetName = name + ".backup" - } - - var target *os.File - if targetName == "-" { - target = os.Stdout - c.global.flagQuiet = true - } else { - target, err = os.Create(shared.HostPathFollow(targetName)) - if err != nil { - return err - } - - defer func() { _ = target.Close() }() - } - // Prepare the download request progress = cli.ProgressRenderer{ Format: i18n.G("Exporting the backup: %s"), diff --git a/lxd/daemon.go b/lxd/daemon.go index 1d2260b8523b..4654db0b92b4 100644 --- a/lxd/daemon.go +++ b/lxd/daemon.go @@ -923,9 +923,9 @@ func (d *Daemon) init() error { if d.os.LXCFeatures["devpts_fd"] && canUseNativeTerminals() { d.os.NativeTerminals = true - logger.Info(" - safe native terminal allocation : yes") + logger.Info(" - safe native terminal allocation: yes") } else { - logger.Info(" - safe native terminal allocation : no") + logger.Info(" - safe native terminal allocation: no") } /* diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go index 2f4a1d01a33f..6b04ee23b4ae 100644 --- a/lxd/instance/drivers/driver_qemu.go +++ b/lxd/instance/drivers/driver_qemu.go @@ -7020,6 +7020,9 @@ func (d *qemu) Exec(req api.InstanceExecPost, stdin *os.File, stdout *os.File, s // websockets for control and for capturing output to a file on the LXD server. req.WaitForWS = true + // Similarly, output recording is performed on the host rather than in the guest, so clear that bit from the request. + req.RecordOutput = false + op, err := agent.ExecInstance("", req, &args) if err != nil { return nil, err diff --git a/lxd/instance/drivers/driver_qemu_cmd.go b/lxd/instance/drivers/driver_qemu_cmd.go index 7cbcb0d18068..845486de56d6 100644 --- a/lxd/instance/drivers/driver_qemu_cmd.go +++ b/lxd/instance/drivers/driver_qemu_cmd.go @@ -5,6 +5,8 @@ import ( "fmt" "io" "strconv" + "strings" + "syscall" "golang.org/x/sys/unix" @@ -13,6 +15,9 @@ import ( "github.com/canonical/lxd/shared/logger" ) +// ErrExecDisconnected is returned when the guest disconnects the exec session. +var ErrExecDisconnected = fmt.Errorf("Disconnected") + // Cmd represents a running command for an Qemu VM. type qemuCmd struct { attachedChildPid int @@ -77,8 +82,10 @@ func (c *qemuCmd) Wait() (int, error) { // Error of type EOF indicates the session ended unexpectedly, // so we inform the client of the disconnection with a more // descriptive message. - if errors.Is(err, io.EOF) { - return exitStatus, fmt.Errorf("Disconnected") + // The error can be different depending on why the VM disconnected + // so we handle these cases similarly. + if errors.Is(err, io.EOF) || strings.Contains(err.Error(), io.ErrUnexpectedEOF.Error()) || strings.Contains(err.Error(), syscall.ECONNRESET.Error()) { + return exitStatus, ErrExecDisconnected } return exitStatus, err diff --git a/lxd/instance_exec.go b/lxd/instance_exec.go index a8520fbacff7..72a262aee80a 100644 --- a/lxd/instance_exec.go +++ b/lxd/instance_exec.go @@ -21,6 +21,7 @@ import ( "github.com/canonical/lxd/lxd/cluster" "github.com/canonical/lxd/lxd/db/operationtype" "github.com/canonical/lxd/lxd/instance" + "github.com/canonical/lxd/lxd/instance/drivers" "github.com/canonical/lxd/lxd/instance/instancetype" "github.com/canonical/lxd/lxd/operations" "github.com/canonical/lxd/lxd/request" @@ -280,7 +281,14 @@ func (s *execWs) Do(op *operations.Operation) error { _ = pty.Close() } + // Make VM disconnections (shutdown/reboot) match containers. + if cmdErr == drivers.ErrExecDisconnected { + cmdResult = 129 + cmdErr = nil + } + metadata := shared.Jmap{"return": cmdResult} + err = op.ExtendMetadata(metadata) if err != nil { return err diff --git a/lxd/main_init_interactive.go b/lxd/main_init_interactive.go index 8fff667affa0..440aee0a7dd2 100644 --- a/lxd/main_init_interactive.go +++ b/lxd/main_init_interactive.go @@ -425,27 +425,51 @@ func (c *cmdInit) askNetworking(config *api.InitPreseed, d lxd.InstanceServer) e } if useExistingInterface { + networks, err := d.GetNetworks() + if err != nil { + return err + } + for { interfaceName, err := c.global.asker.AskString("Name of the existing bridge or host interface: ", "", nil) if err != nil { return err } - if !shared.PathExists(fmt.Sprintf("/sys/class/net/%s", interfaceName)) { + // Try to find the existing network. + var network *api.Network + for _, n := range networks { + if n.Name == interfaceName { + network = &n + break + } + } + + if network == nil { fmt.Println("The requested interface doesn't exist. Please choose another one.") continue } - // Add to the default profile - config.Node.Profiles[0].Devices["eth0"] = map[string]string{ - "type": "nic", - "nictype": "macvlan", - "name": "eth0", - "parent": interfaceName, - } + // Add to the default profile. + if network.Managed { + // Add managed network. + config.Node.Profiles[0].Devices["eth0"] = map[string]string{ + "name": "eth0", + "type": "nic", + "network": network.Name, + } + } else { + // Add unmanaged network. + config.Node.Profiles[0].Devices["eth0"] = map[string]string{ + "name": "eth0", + "type": "nic", + "nictype": "macvlan", + "parent": network.Name, + } - if shared.PathExists(fmt.Sprintf("/sys/class/net/%s/bridge", interfaceName)) { - config.Node.Profiles[0].Devices["eth0"]["nictype"] = "bridged" + if network.Type == "bridge" { + config.Node.Profiles[0].Devices["eth0"]["nictype"] = "bridged" + } } if config.Node.Config["maas.api.url"] != nil { diff --git a/lxd/storage/drivers/utils.go b/lxd/storage/drivers/utils.go index 1d5406c8e8f7..d551db2a6bf7 100644 --- a/lxd/storage/drivers/utils.go +++ b/lxd/storage/drivers/utils.go @@ -517,21 +517,20 @@ func growFileSystem(fsType string, devPath string, vol Volume) error { } return vol.MountTask(func(mountPath string, op *operations.Operation) error { - var msg string var err error switch fsType { case "ext4": - msg, err = shared.TryRunCommand("resize2fs", devPath) + _, err = shared.TryRunCommand("resize2fs", devPath) case "xfs": - msg, err = shared.TryRunCommand("xfs_growfs", mountPath) + _, err = shared.TryRunCommand("xfs_growfs", mountPath) case "btrfs": - msg, err = shared.TryRunCommand("btrfs", "filesystem", "resize", "max", mountPath) + _, err = shared.TryRunCommand("btrfs", "filesystem", "resize", "max", mountPath) default: return fmt.Errorf("Unrecognised filesystem type %q", fsType) } if err != nil { - return fmt.Errorf("Could not grow underlying %q filesystem for %q: %s", fsType, devPath, msg) + return fmt.Errorf("Could not grow underlying %q filesystem for %q: %w", fsType, devPath, err) } return nil diff --git a/lxd/sys/os.go b/lxd/sys/os.go index 60c222cefd86..e1952b92e2e1 100644 --- a/lxd/sys/os.go +++ b/lxd/sys/os.go @@ -82,21 +82,20 @@ type OS struct { // Kernel features CloseRange bool + ContainerCoreScheduling bool CoreScheduling bool IdmappedMounts bool + NativeTerminals bool NetnsGetifaddrs bool + PidFds bool PidFdSetns bool + SeccompListenerAddfd bool SeccompListener bool SeccompListenerContinue bool Shiftfs bool UeventInjection bool VFS3Fscaps bool - ContainerCoreScheduling bool - NativeTerminals bool - PidFds bool - SeccompListenerAddfd bool - // LXC features LXCFeatures map[string]bool diff --git a/po/ber.po b/po/ber.po index cccbcee3aa7b..295cb2f25384 100644 --- a/po/ber.po +++ b/po/ber.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: lxd\n" "Report-Msgid-Bugs-To: lxd@lists.canonical.com\n" -"POT-Creation-Date: 2024-07-11 09:44+0100\n" +"POT-Creation-Date: 2024-10-01 10:44+0100\n" "PO-Revision-Date: 2022-03-10 15:10+0000\n" "Last-Translator: Anonymous \n" "Language-Team: Berber \n" "Language-Team: Bulgarian \n" "Language-Team: Catalan \n" "Language-Team: Czech \n" "Language-Team: German \n" "Language-Team: Greek \n" "Language-Team: Esperanto \n" "Language-Team: Spanish \n" "Language-Team: Persian \n" "Language-Team: Finnish \n" "Language-Team: French \n" "Language-Team: Hebrew \n" "Language-Team: Hindi \n" "Language-Team: Indonesian \n" "Language-Team: Italian \n" "Language-Team: Japanese \n" "Language-Team: Korean \n" "Language-Team: LANGUAGE \n" @@ -626,7 +626,7 @@ msgstr "" msgid "BASE IMAGE" msgstr "" -#: lxc/export.go:86 +#: lxc/export.go:106 #, c-format msgid "Backing up instance: %s" msgstr "" diff --git a/po/mr.po b/po/mr.po index 5b7f94653809..1611f2a35fe6 100644 --- a/po/mr.po +++ b/po/mr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: lxd\n" "Report-Msgid-Bugs-To: lxd@lists.canonical.com\n" -"POT-Creation-Date: 2024-07-11 09:44+0100\n" +"POT-Creation-Date: 2024-10-01 10:44+0100\n" "PO-Revision-Date: 2022-03-10 15:10+0000\n" "Last-Translator: Anonymous \n" "Language-Team: Marathi \n" "Language-Team: Norwegian Bokmål \n" "Language-Team: Dutch \n" "Language-Team: Punjabi \n" "Language-Team: Polish \n" "Language-Team: Portuguese (Brazil) \n" "Language-Team: Russian \n" "Language-Team: Sinhala \n" "Language-Team: Slovenian \n" "Language-Team: Serbian \n" "Language-Team: Swedish \n" "Language-Team: Telugu \n" "Language-Team: Turkish \n" "Language-Team: Tamazight (Central Atlas) \n" "Language-Team: Uyghur \n" "Language-Team: Ukrainian \n" "Language-Team: Chinese (Simplified) \n" "Language-Team: Chinese (Traditional) Checking for imports/deps that have been added to ${pkg}..." + DEP_FILE="test/godeps/$(echo "${pkg}" | sed 's/\//-/g').list" - OUT="$(go list -f '{{ join .Deps "\n" }}' ./${pkg} | grep -F . | sort -u | diff --new-file -u "${DEP_FILE}" - || true)" + + TAGS="" + [ "${pkg}" = "lxd-agent" ] && TAGS="-tags agent,netgo" + + OUT="$(go list ${TAGS:+${TAGS}} -f '{{ join .Deps "\n" }}' ./${pkg} | grep -F . | sort -u | diff --new-file -u "${DEP_FILE}" - || true)" if [ -n "${OUT}" ]; then echo "ERROR: you added a new dependency to ${pkg}; please make sure this is what you want" echo "${OUT}" diff --git a/test/main.sh b/test/main.sh index d25b9f284a1c..f96e2ede5e47 100755 --- a/test/main.sh +++ b/test/main.sh @@ -90,9 +90,22 @@ cleanup() { if [ "${TEST_RESULT}" != "success" ]; then # dmesg may contain oops, IO errors, crashes, etc - echo "::group::dmesg logs" + # If there's a kernel stack trace, don't generate a collapsible group + + expandDmesg=no + if journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --dmesg --grep="Call Trace:" > /dev/null; then + expandDmesg=yes + fi + + if [ "${expandDmesg}" = "no" ]; then + echo "::group::dmesg logs" + else + echo "dmesg logs" + fi journalctl --quiet --no-hostname --no-pager --boot=0 --lines=100 --dmesg - echo "::endgroup::" + if [ "${expandDmesg}" = "no" ]; then + echo "::endgroup::" + fi fi if [ -n "${GITHUB_ACTIONS:-}" ]; then diff --git a/test/suites/exec.sh b/test/suites/exec.sh index 44e63829dde4..5046afcf06c9 100644 --- a/test/suites/exec.sh +++ b/test/suites/exec.sh @@ -93,5 +93,19 @@ test_exec_exit_code() { lxc exec x1 -- invalid-command || exitCode=$? [ "${exitCode:-0}" -eq 127 ] + # Try disconnecting a container stopping forcefully and gracefully to make sure they differ appropriately. + (sleep 1 && lxc stop -f x1) & + lxc exec x1 -- sleep 10 || exitCode=$? + [ "${exitCode:-0}" -eq 137 ] + + wait $! + lxc start x1 + sleep 2 + (sleep 1 && lxc stop x1) & + lxc exec x1 -- sleep 10 || exitCode=$? + # Both 129 and 143 have been seen and both make sense here. + [ "${exitCode:-0}" -eq 129 ] || [ "${exitCode:-0}" -eq 143 ] + + wait $! lxc delete --force x1 } diff --git a/test/suites/projects.sh b/test/suites/projects.sh index 5686d92ea554..76f9e2f70999 100644 --- a/test/suites/projects.sh +++ b/test/suites/projects.sh @@ -1040,7 +1040,7 @@ test_projects_usage() { limits.cpu=1 \ limits.memory=512MiB \ limits.processes=20 - lxc profile device set default root size=3GiB --project test-usage + lxc profile device set default root size=300MiB --project test-usage # Spin up a container deps/import-busybox --project test-usage --alias testimage @@ -1049,7 +1049,7 @@ test_projects_usage() { lxc project info test-usage --format csv | grep -q "CONTAINERS,UNLIMITED,1" lxc project info test-usage --format csv | grep -q "CPU,5,1" - lxc project info test-usage --format csv | grep -q "DISK,10.00GiB,3.00GiB" + lxc project info test-usage --format csv | grep -q "DISK,10.00GiB,300.00MiB" lxc project info test-usage --format csv | grep -q "INSTANCES,UNLIMITED,1" lxc project info test-usage --format csv | grep -q "MEMORY,1.00GiB,512.00MiB" lxc project info test-usage --format csv | grep -q "NETWORKS,3,0" diff --git a/test/suites/remote.sh b/test/suites/remote.sh index ade7aca3564c..b09f1c923450 100644 --- a/test/suites/remote.sh +++ b/test/suites/remote.sh @@ -22,8 +22,8 @@ test_remote_url() { # Check that we can add simplestream remotes with valid certs without confirmation if [ -z "${LXD_OFFLINE:-}" ]; then - lxc_remote remote add ubuntu1 https://cloud-images.ubuntu.com/releases --protocol=simplestreams - lxc_remote remote add ubuntu2 https://cloud-images.ubuntu.com:443/releases --protocol=simplestreams + lxc_remote remote add ubuntu1 https://cloud-images.ubuntu.com/releases/ --protocol=simplestreams + lxc_remote remote add ubuntu2 https://cloud-images.ubuntu.com:443/releases/ --protocol=simplestreams lxc_remote remote remove ubuntu1 lxc_remote remote remove ubuntu2 fi