Reuse RemoteDirect function for redfish dell client

Change-Id: I17726cae6f4d1f99e1cec4fa7a29c1a9e1dee3d5
This commit is contained in:
Kostiantyn Kalynovskyi 2021-01-29 20:30:17 +00:00 committed by Kostyantyn Kalynovskyi
parent a89666a36e
commit 0a5f1e2ca4
2 changed files with 15 additions and 4 deletions

View File

@ -275,8 +275,13 @@ func (c *Client) SystemPowerStatus(ctx context.Context) (power.Status, error) {
// RemoteDirect implements remote direct interface // RemoteDirect implements remote direct interface
func (c *Client) RemoteDirect(ctx context.Context, isoURL string) error { func (c *Client) RemoteDirect(ctx context.Context, isoURL string) error {
return RemoteDirect(ctx, isoURL, c.redfishURL, c)
}
// RemoteDirect allows to perform remotedirect
func RemoteDirect(ctx context.Context, isoURL, redfishURL string, c ifc.Client) error {
log.Debugf("Bootstrapping ephemeral host with ID '%s' and BMC Address '%s'.", c.NodeID(), log.Debugf("Bootstrapping ephemeral host with ID '%s' and BMC Address '%s'.", c.NodeID(),
c.redfishURL) redfishURL)
powerStatus, err := c.SystemPowerStatus(ctx) powerStatus, err := c.SystemPowerStatus(ctx)
if err != nil { if err != nil {

View File

@ -53,6 +53,7 @@ const (
type Client struct { type Client struct {
username string username string
password string password string
redfishURL string
redfish.Client redfish.Client
RedfishAPI redfishAPI.RedfishAPI RedfishAPI redfishAPI.RedfishAPI
RedfishCFG *redfishClient.Configuration RedfishCFG *redfishClient.Configuration
@ -127,6 +128,11 @@ func (c *Client) SetBootSourceByType(ctx context.Context) error {
return nil return nil
} }
// RemoteDirect implements remote direct interface
func (c *Client) RemoteDirect(ctx context.Context, isoURL string) error {
return redfish.RemoteDirect(ctx, isoURL, c.redfishURL, c)
}
// newClient returns a client with the capability to make Redfish requests. // newClient returns a client with the capability to make Redfish requests.
func newClient(redfishURL string, func newClient(redfishURL string,
insecure bool, insecure bool,
@ -141,7 +147,7 @@ func newClient(redfishURL string,
return nil, err return nil, err
} }
c := &Client{username, password, *genericClient, genericClient.RedfishAPI, genericClient.RedfishCFG} c := &Client{username, password, redfishURL, *genericClient, genericClient.RedfishAPI, genericClient.RedfishCFG}
return c, nil return c, nil
} }