Skip to content

Commit

Permalink
lxd/daemon: Use hostname as default instance property on standalone s…
Browse files Browse the repository at this point in the history
…ystems

Closes lxc/incus#762

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
(cherry picked from commit f7acfd818d3538c9908438bb92e64ec669dbd165)
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
License: Apache-2.0
  • Loading branch information
stgraber authored and simondeziel committed May 3, 2024
1 parent 0e34636 commit 8525497
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lxd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,16 @@ func (d *Daemon) setupLoki(URL string, cert string, key string, caCert string, i

// Figure out the instance name.
if instanceName == "" {
instanceName = d.serverName
if d.serverClustered {
instanceName = d.serverName
} else {
hostname, err := os.Hostname()
if err != nil {
return err
}

instanceName = hostname
}
}

// Start a new client.
Expand Down

0 comments on commit 8525497

Please sign in to comment.