Skip to content

Commit

Permalink
Merge branch 'main' into improved-cli-completions
Browse files Browse the repository at this point in the history
Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Sep 3, 2024
2 parents 2c1950e + 4633da9 commit fa4403b
Show file tree
Hide file tree
Showing 172 changed files with 20,955 additions and 16,080 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
- name: Unit tests (all)
run: |
set -eux
sudo --preserve-env=CGO_CFLAGS,CGO_LDFLAGS,CGO_LDFLAGS_ALLOW,LD_LIBRARY_PATH LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env "PATH=${PATH}" go test ./...
sudo --preserve-env=CGO_CFLAGS,CGO_LDFLAGS,CGO_LDFLAGS_ALLOW,LD_LIBRARY_PATH LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env "PATH=${PATH}" go test -v ./...
system-tests:
env:
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ ifneq "$(LXD_OFFLINE)" ""
endif
go get -t -v -d -u ./...
go get github.com/gorilla/[email protected] # Due to riscv64 crashes in LP
go get github.com/openfga/[email protected] # Due to build failures
go mod tidy -go=$(GOMIN)

@echo "Dependencies updated"
Expand Down
117 changes: 99 additions & 18 deletions client/lxd_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,9 @@ func (r *ProtocolLXD) tryCreateInstance(req api.InstancesPost, urls []string, op
operation := req.Source.Operation

// Forward targetOp to remote op
chConnect := make(chan error, 1)
chWait := make(chan error, 1)

go func() {
success := false
var errors []remoteOperationResult
Expand Down Expand Up @@ -762,13 +765,35 @@ func (r *ProtocolLXD) tryCreateInstance(req api.InstancesPost, urls []string, op
break
}

if !success {
rop.err = remoteOperationError("Failed instance creation", errors)
if success {
chConnect <- nil
close(chConnect)
} else {
chConnect <- remoteOperationError("Failed instance creation", errors)
close(chConnect)

if op != nil {
_ = op.Cancel()
}
}
}()

if op != nil {
go func() {
chWait <- op.Wait()
close(chWait)
}()
}

go func() {
var err error

select {
case err = <-chConnect:
case err = <-chWait:
}

rop.err = err
close(rop.chDone)
}()

Expand Down Expand Up @@ -953,7 +978,12 @@ func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance,

targetSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Prepare the source request
Expand Down Expand Up @@ -981,7 +1011,12 @@ func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance,

sourceSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
sourceSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

sourceSecrets[k] = vStr
}

// Relay mode migration
Expand All @@ -1001,7 +1036,12 @@ func (r *ProtocolLXD) CopyInstance(source InstanceServer, instance api.Instance,
// Extract the websockets
targetSecrets := map[string]string{}
for k, v := range targetOpAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Launch the relay
Expand Down Expand Up @@ -1243,9 +1283,16 @@ func (r *ProtocolLXD) ExecInstance(instanceName string, exec api.InstanceExecPos

value, ok := opAPI.Metadata["fds"]
if ok {
values := value.(map[string]any)
for k, v := range values {
fds[k] = v.(string)
values, ok := value.(map[string]any)
if ok {
for k, v := range values {
vStr, ok := v.(string)
if !ok {
continue
}

fds[k] = vStr
}
}
}

Expand All @@ -1260,7 +1307,12 @@ func (r *ProtocolLXD) ExecInstance(instanceName string, exec api.InstanceExecPos
outputs, ok := opAPI.Metadata["output"].(map[string]any)
if ok {
for k, v := range outputs {
outputFiles[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

outputFiles[k] = vStr
}
}

Expand Down Expand Up @@ -1992,7 +2044,12 @@ func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName s

targetSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Prepare the source request
Expand Down Expand Up @@ -2020,7 +2077,12 @@ func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName s

sourceSecrets := map[string]string{}
for k, v := range opAPI.Metadata {
sourceSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

sourceSecrets[k] = vStr
}

// Relay mode migration
Expand All @@ -2040,7 +2102,12 @@ func (r *ProtocolLXD) CopyInstanceSnapshot(source InstanceServer, instanceName s
// Extract the websockets
targetSecrets := map[string]string{}
for k, v := range targetOpAPI.Metadata {
targetSecrets[k] = v.(string)
vStr, ok := v.(string)
if !ok {
continue
}

targetSecrets[k] = vStr
}

// Launch the relay
Expand Down Expand Up @@ -2596,9 +2663,16 @@ func (r *ProtocolLXD) ConsoleInstance(instanceName string, console api.InstanceC

value, ok := opAPI.Metadata["fds"]
if ok {
values := value.(map[string]any)
for k, v := range values {
fds[k] = v.(string)
values, ok := value.(map[string]any)
if ok {
for k, v := range values {
vStr, ok := v.(string)
if !ok {
continue
}

fds[k] = vStr
}
}
}

Expand Down Expand Up @@ -2688,9 +2762,16 @@ func (r *ProtocolLXD) ConsoleInstanceDynamic(instanceName string, console api.In

value, ok := opAPI.Metadata["fds"]
if ok {
values := value.(map[string]any)
for k, v := range values {
fds[k] = v.(string)
values, ok := value.(map[string]any)
if ok {
for k, v := range values {
vStr, ok := v.(string)
if !ok {
continue
}

fds[k] = vStr
}
}
}

Expand Down
24 changes: 21 additions & 3 deletions doc/.custom_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ balancers
benchmarking
BGP
BitLocker
BLK
bool
bootable
BPF
Btrfs
bugfix
bugfixes
CDI
CentOS
Ceph
CephFS
Expand All @@ -41,9 +43,11 @@ CPUs
CRIU
CRL
cron
CSM
CSV
CUDA
dataset
dGPU
DCO
dereferenced
DHCP
Expand All @@ -62,6 +66,7 @@ ECDSA
EiB
Eibit
endian
EOL
ES
ESA
ETag
Expand Down Expand Up @@ -89,10 +94,12 @@ hotplugging
HTTPS
HWE
ICMP
IdP
idmap
idmapped
idmaps
IdP
iGPU
iGPUs
incrementing
InfiniBand
init
Expand All @@ -112,9 +119,9 @@ KiB
kibi
Kibit
KVM
LogCLI
lookups
LoongArch
LogCLI
LRU
LV
LVM
Expand All @@ -133,9 +140,10 @@ MiB
Mibit
MicroCeph
MicroCloud
MinIO
MII
MinIO
MITM
MNIST
MTU
Mullvad
multicast
Expand All @@ -149,7 +157,10 @@ NIC
NICs
NUMA
NVMe
NVML
NVRAM
NVIDIA
OCI
OData
OIDC
OpenFGA
Expand Down Expand Up @@ -190,6 +201,7 @@ qgroups
RADOS
RBAC
RBD
RDP
README
reconfiguring
requestor
Expand All @@ -203,11 +215,13 @@ SATA
scalable
scriptlet
SDC
SDK
SDN
SDS
SDT
SeaBIOS
Seccomp
SELinux
SEV
SFTP
SHA
Expand All @@ -216,8 +230,10 @@ SIGTERM
simplestreams
SKBPRIO
SLAAC
SLES
SMTP
Snapcraft
SoC
Solaris
SPAs
SPL
Expand Down Expand Up @@ -251,6 +267,8 @@ sysfs
syslog
Tbit
TCP
TensorRT
Tegra
TiB
Tibit
TinyPNG
Expand Down
2 changes: 0 additions & 2 deletions doc/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ build:
- git fetch --unshallow || true
pre_build:
- go build -ldflags "-s -w" -o trimpath -o lxc.bin ./lxc
post_build:
- cd _readthedocs/html; python -m sphinx.ext.intersphinx 'objects.inv' > objects.inv.txt

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
14 changes: 14 additions & 0 deletions doc/.sphinx/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,20 @@ p code.literal {
color: #BB5400;
}

.rubric > .hclass2, .rubric.hclass2 {
display: block;
font-size: 2em;
border-radius: .5rem;
font-weight: 300;
line-height: 1.25;
margin-top: 1.75rem;
margin-right: -0.5rem;
margin-bottom: 0.5rem;
margin-left: -0.5rem;
padding-left: .5rem;
padding-right: .5rem;
}

/* Exception for LXD: smaller font size for option table fields */
.configoption .fields p code.literal {
font-size: var(--font-size--small--2);
Expand Down
Binary file added doc/.sphinx/fonts/Ubuntu-B.ttf
Binary file not shown.
Binary file added doc/.sphinx/fonts/Ubuntu-R.ttf
Binary file not shown.
Binary file added doc/.sphinx/fonts/Ubuntu-RI.ttf
Binary file not shown.
Binary file added doc/.sphinx/fonts/UbuntuMono-B.ttf
Binary file not shown.
Binary file added doc/.sphinx/fonts/UbuntuMono-R.ttf
Binary file not shown.
Binary file added doc/.sphinx/fonts/UbuntuMono-RI.ttf
Binary file not shown.
Loading

0 comments on commit fa4403b

Please sign in to comment.