use ipmi interface from node.NodeConf
Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
committed by
Jonathon Anderson
parent
37bf90c588
commit
10ea0ac78d
@@ -59,16 +59,17 @@ type ProfileConf struct {
|
||||
}
|
||||
|
||||
type IpmiConf struct {
|
||||
UserName string `yaml:"username,omitempty" lopt:"ipmiuser" comment:"Set the IPMI username"`
|
||||
Password string `yaml:"password,omitempty" lopt:"ipmipass" comment:"Set the IPMI password"`
|
||||
Ipaddr net.IP `yaml:"ipaddr,omitempty" lopt:"ipmiaddr" comment:"Set the IPMI IP address" type:"IP"`
|
||||
Gateway net.IP `yaml:"gateway,omitempty" lopt:"ipmigateway" comment:"Set the IPMI gateway" type:"IP"`
|
||||
Netmask net.IP `yaml:"netmask,omitempty" lopt:"ipminetmask" comment:"Set the IPMI netmask" type:"IP"`
|
||||
Port string `yaml:"port,omitempty" lopt:"ipmiport" comment:"Set the IPMI port"`
|
||||
Interface string `yaml:"interface,omitempty" lopt:"ipmiinterface" comment:"Set the node's IPMI interface (defaults: 'lan')"`
|
||||
EscapeChar string `yaml:"escapechar,omitempty" lopt:"ipmiescapechar" comment:"Set the IPMI escape character (defaults: '~')"`
|
||||
Write wwtype.WWbool `yaml:"write,omitempty" lopt:"ipmiwrite" comment:"Enable the write of impi configuration (true/false)"`
|
||||
Tags map[string]string `yaml:"tags,omitempty"`
|
||||
UserName string `yaml:"username,omitempty" lopt:"ipmiuser" comment:"Set the IPMI username"`
|
||||
Password string `yaml:"password,omitempty" lopt:"ipmipass" comment:"Set the IPMI password"`
|
||||
Ipaddr net.IP `yaml:"ipaddr,omitempty" lopt:"ipmiaddr" comment:"Set the IPMI IP address" type:"IP"`
|
||||
Gateway net.IP `yaml:"gateway,omitempty" lopt:"ipmigateway" comment:"Set the IPMI gateway" type:"IP"`
|
||||
Netmask net.IP `yaml:"netmask,omitempty" lopt:"ipminetmask" comment:"Set the IPMI netmask" type:"IP"`
|
||||
Port string `yaml:"port,omitempty" lopt:"ipmiport" comment:"Set the IPMI port"`
|
||||
Interface string `yaml:"interface,omitempty" lopt:"ipmiinterface" comment:"Set the node's IPMI interface (defaults: 'lan')"`
|
||||
EscapeChar string `yaml:"escapechar,omitempty" lopt:"ipmiescapechar" comment:"Set the IPMI escape character (defaults: '~')"`
|
||||
Write wwtype.WWbool `yaml:"write,omitempty" lopt:"ipmiwrite" comment:"Enable the write of impi configuration (true/false)"`
|
||||
BmcTemplate string `yaml:"template,omitempty" lopt:"ipmitemplate" comment:"template used for ipmi command"`
|
||||
Tags map[string]string `yaml:"tags,omitempty"`
|
||||
}
|
||||
|
||||
type KernelConf struct {
|
||||
|
||||
@@ -4,6 +4,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/hpcng/warewulf/internal/pkg/node"
|
||||
)
|
||||
|
||||
type IPMIResult struct {
|
||||
@@ -12,15 +14,8 @@ type IPMIResult struct {
|
||||
}
|
||||
|
||||
type IPMI struct {
|
||||
NodeName string
|
||||
HostName string
|
||||
Port string
|
||||
User string
|
||||
Password string
|
||||
AuthType string
|
||||
Interface string
|
||||
EscapeChar string
|
||||
result IPMIResult
|
||||
node.IpmiConf
|
||||
result IPMIResult
|
||||
}
|
||||
|
||||
func (ipmi *IPMI) Result() (string, error) {
|
||||
@@ -40,7 +35,7 @@ func (ipmi *IPMI) Command(ipmiArgs []string) ([]byte, error) {
|
||||
if ipmi.EscapeChar == "" {
|
||||
ipmi.EscapeChar = "~"
|
||||
}
|
||||
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-p", ipmi.Port, "-U", ipmi.User, "-P", ipmi.Password, "-e", ipmi.EscapeChar)
|
||||
args = append(args, "-I", ipmi.Interface, "-H", ipmi.Ipaddr, "-p", ipmi.Port, "-U", ipmi.UserName, "-P", ipmi.Password, "-e", ipmi.EscapeChar)
|
||||
args = append(args, ipmiArgs...)
|
||||
ipmiCmd := exec.Command("ipmitool", args...)
|
||||
return ipmiCmd.CombinedOutput()
|
||||
@@ -59,7 +54,7 @@ func (ipmi *IPMI) InteractiveCommand(ipmiArgs []string) error {
|
||||
if ipmi.EscapeChar == "" {
|
||||
ipmi.EscapeChar = "~"
|
||||
}
|
||||
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-p", ipmi.Port, "-U", ipmi.User, "-P", ipmi.Password, "-e", ipmi.EscapeChar)
|
||||
args = append(args, "-I", ipmi.Interface, "-H", ipmi.Ipaddr, "-p", ipmi.Port, "-U", ipmi.UserName, "-P", ipmi.Password, "-e", ipmi.EscapeChar)
|
||||
args = append(args, ipmiArgs...)
|
||||
ipmiCmd := exec.Command("ipmitool", args...)
|
||||
ipmiCmd.Stdout = os.Stdout
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package power
|
||||
|
||||
//type PowerControl interface {
|
||||
//PowerOn() (result string, err error)
|
||||
//PowerOff() (result string, err error)
|
||||
//PowerStatus() (result string, err error)
|
||||
//}
|
||||
|
||||
type PowerOnInterface interface {
|
||||
PowerOn() (result string, err error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user