Skip to content

Commit

Permalink
lxd/storage/connectors: Remove ConnectAll and DisconnectAll
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Pelizäus <[email protected]>
  • Loading branch information
roosterfish committed Jan 31, 2025
1 parent c4813cb commit 8e6bd40
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 38 deletions.
2 changes: 0 additions & 2 deletions lxd/storage/connectors/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ type Connector interface {
QualifiedName() (string, error)
LoadModules() error
Connect(ctx context.Context, targetQN string, targetAddrs ...string) (revert.Hook, error)
ConnectAll(ctx context.Context, targetAddr string) error
Disconnect(targetQN string) error
DisconnectAll() error
SessionID(targetQN string) (string, error)
findSession(targetQN string) (*session, error)
}
Expand Down
25 changes: 0 additions & 25 deletions lxd/storage/connectors/connector_nvme.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,6 @@ func (c *connectorNVMe) Connect(ctx context.Context, targetQN string, targetAddr
return connect(ctx, c, targetQN, targetAddresses, connectFunc)
}

// ConnectAll establishes a connection with all targets available on the given address.
func (c *connectorNVMe) ConnectAll(ctx context.Context, targetAddr string) error {
hostNQN, err := c.QualifiedName()
if err != nil {
return err
}

_, err = shared.RunCommandContext(ctx, "nvme", "connect-all", "--transport", "tcp", "--traddr", targetAddr, "--hostnqn", hostNQN, "--hostid", c.serverUUID)
if err != nil {
return fmt.Errorf("Failed to connect to any target on %q via NVMe: %w", targetAddr, err)
}

return nil
}

// Disconnect terminates a connection with the target.
func (c *connectorNVMe) Disconnect(targetQN string) error {
// Find an existing NVMe session.
Expand All @@ -122,16 +107,6 @@ func (c *connectorNVMe) Disconnect(targetQN string) error {
return nil
}

// DisconnectAll terminates all connections with all targets.
func (c *connectorNVMe) DisconnectAll() error {
_, err := shared.RunCommand("nvme", "disconnect-all")
if err != nil {
return fmt.Errorf("Failed disconnecting from NVMe targets: %w", err)
}

return nil
}

// SessionID returns the identifier of a session that matches the targetQN.
// If no session is found, an empty string is returned.
func (c *connectorNVMe) SessionID(targetQN string) (string, error) {
Expand Down
11 changes: 0 additions & 11 deletions lxd/storage/connectors/connector_sdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,11 @@ func (c *connectorSDC) Connect(ctx context.Context, targetQN string, targetAddre
return revert.New().Fail, nil
}

// ConnectAll does nothing. Connections are fully handled by SDC.
func (c *connectorSDC) ConnectAll(ctx context.Context, targetAddr string) error {
// Nothing to do. Connection is handled by Dell SDC.
return nil
}

// Disconnect does nothing. Connections are fully handled by SDC.
func (c *connectorSDC) Disconnect(targetQN string) error {
return nil
}

// DisconnectAll does nothing. Connections are fully handled by SDC.
func (c *connectorSDC) DisconnectAll() error {
return nil
}

func (c *connectorSDC) findSession(targetQN string) (*session, error) {
return nil, nil
}

0 comments on commit 8e6bd40

Please sign in to comment.