Skip to content

Commit 27d2f89

Browse files
committed
incus: fix starting with runtime disk
Signed-off-by: Abiola Ibrahim <git@abiosoft.com>
1 parent 15fd64a commit 27d2f89

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

environment/container/incus/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ networks:
99
project: default
1010
storage_pools:
1111
- config:
12-
size: {{.Disk}}GiB
12+
source: {{.Disk}}
1313
description: ""
1414
name: default
1515
driver: zfs

environment/container/incus/incus.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,30 @@ func (c *incusRuntime) Dependencies() []string {
5353

5454
// Provision implements environment.Container.
5555
func (c *incusRuntime) Provision(ctx context.Context) error {
56-
conf, _ := ctx.Value(config.CtxKey()).(config.Config)
56+
// ensure that the systemd socket file is created
57+
if err := c.guest.RunQuiet("sudo", "systemctl", "start", "incus.socket"); err != nil {
58+
return fmt.Errorf("error starting incus socket: %w", err)
59+
}
60+
61+
if err := c.guest.RunQuiet("sudo", "systemctl", "start", "incus.service"); err != nil {
62+
return fmt.Errorf("error starting incus service: %w", err)
63+
}
5764

5865
if err := c.guest.RunQuiet("ip", "addr", "show", incusBridgeInterface); err == nil {
5966
// already provisioned
6067
return nil
6168
}
6269

63-
// ensure that the systemd socket file is created
64-
if err := c.guest.RunQuiet("sudo", "systemctl", "start", "incus.socket", "incus.service"); err != nil {
65-
return fmt.Errorf("error starting incus socket: %w", err)
66-
}
67-
6870
if limautil.DiskProvisioned(Name) {
6971
// disk already provisioned
7072
return nil
7173
}
7274

7375
var value struct {
74-
Disk int
76+
Disk string
7577
Interface string
7678
}
77-
value.Disk = conf.Disk - 5 // use all disk except 5GiB. TODO: revisit.
79+
value.Disk = "/dev/vdb"
7880
value.Interface = incusBridgeInterface
7981

8082
buf, err := util.ParseTemplate(configYaml, value)

0 commit comments

Comments
 (0)