From b2cd85c70d572d8fe5d8e1240700a41e5eb3a43f Mon Sep 17 00:00:00 2001 From: Din Music Date: Thu, 19 Dec 2024 09:04:51 +0000 Subject: [PATCH] lxd/storage/drivers/powerflex: Use shared function to resolve server name Signed-off-by: Din Music --- lxd/storage/drivers/driver_powerflex_utils.go | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lxd/storage/drivers/driver_powerflex_utils.go b/lxd/storage/drivers/driver_powerflex_utils.go index 3217a874640f..96b3785f60e6 100644 --- a/lxd/storage/drivers/driver_powerflex_utils.go +++ b/lxd/storage/drivers/driver_powerflex_utils.go @@ -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 { @@ -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 }