Skip to content

Commit

Permalink
lxd/storage/drivers/powerflex: Use shared function to resolve server …
Browse files Browse the repository at this point in the history
…name

Signed-off-by: Din Music <[email protected]>
  • Loading branch information
MusicDin committed Dec 19, 2024
1 parent 119e49a commit b2cd85c
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions lxd/storage/drivers/driver_powerflex_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,21 +792,6 @@ func (d *powerflex) getHostGUID() (string, error) {
return d.sdcGUID, nil
}

// getServerName returns the hostname of this host.
// It prefers the value from the daemons state in case LXD is clustered.
func (d *powerflex) getServerName() (string, error) {
if d.state.ServerName != "none" {
return d.state.ServerName, nil
}

hostname, err := os.Hostname()
if err != nil {
return "", fmt.Errorf("Failed to get hostname: %w", err)
}

return hostname, nil
}

// getVolumeType returns the selected provisioning type of the volume.
// As a default it returns type thin.
func (d *powerflex) getVolumeType(vol Volume) powerFlexVolumeType {
Expand Down Expand Up @@ -837,7 +822,7 @@ func (d *powerflex) createNVMeHost() (string, revert.Hook, error) {
return "", nil, err
}

hostname, err := d.getServerName()
hostname, err := ResolveServerName(d.state.ServerName)
if err != nil {
return "", nil, err
}
Expand Down

0 comments on commit b2cd85c

Please sign in to comment.