Merge branch 'main' into cleanups2

This commit is contained in:
Gregory Kurtzer
2021-08-24 22:46:35 -07:00
19 changed files with 68 additions and 9 deletions

View File

@@ -0,0 +1,5 @@
FROM warewulf/rocky:8
RUN dnf -y install http://repos.openhpc.community/OpenHPC/2/CentOS_8/x86_64/ohpc-release-2-1.el8.x86_64.rpm; \
dnf -y install ohpc-base-compute ohpc-slurm-client chrony; \
systemctl enable munge

View File

@@ -47,6 +47,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Root", node.Root.Source(), node.Root.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Root", node.Root.Source(), node.Root.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiIpaddr", node.IpmiIpaddr.Source(), node.IpmiIpaddr.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiIpaddr", node.IpmiIpaddr.Source(), node.IpmiIpaddr.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiNetmask", node.IpmiNetmask.Source(), node.IpmiNetmask.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiNetmask", node.IpmiNetmask.Source(), node.IpmiNetmask.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiPort", node.IpmiPort.Source(), node.IpmiPort.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiGateway", node.IpmiGateway.Source(), node.IpmiGateway.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiGateway", node.IpmiGateway.Source(), node.IpmiGateway.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiUserName", node.IpmiUserName.Source(), node.IpmiUserName.Print())
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.IpmiInterface.Source(), node.IpmiInterface.Print()) fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "IpmiInterface", node.IpmiInterface.Source(), node.IpmiInterface.Print())
@@ -80,11 +81,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
} }
} else if ShowIpmi { } else if ShowIpmi {
fmt.Printf("%-22s %-16s %-20s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI USERNAME", "IPMI PASSWORD", "IPMI INTERFACE") fmt.Printf("%-22s %-16s %-5s %-20s %-20s %-20s\n", "NODE NAME", "IPMI IPADDR", "IPMI PORT", "IPMI USERNAME", "IPMI PASSWORD", "IPMI INTERFACE")
fmt.Println(strings.Repeat("=", 80)) fmt.Println(strings.Repeat("=", 80))
for _, node := range node.FilterByName(nodes, args) { for _, node := range node.FilterByName(nodes, args) {
fmt.Printf("%-22s %-16s %-20s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print(), node.IpmiInterface.Print()) fmt.Printf("%-22s %-16s %-5s %-20s %-20s %-20s\n", node.Id.Get(), node.IpmiIpaddr.Print(), node.IpmiPort.Print(), node.IpmiUserName.Print(), node.IpmiPassword.Print(), node.IpmiInterface.Print())
} }
} else if ShowLong { } else if ShowLong {

View File

@@ -52,9 +52,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
if node.IpmiInterface.Get() != "" { if node.IpmiInterface.Get() != "" {
ipmiInterface = node.IpmiInterface.Get() ipmiInterface = node.IpmiInterface.Get()
} }
var ipmiPort = "623"
if node.IpmiPort.Get() != "" {
ipmiPort = node.IpmiPort.Get()
}
ipmiCmd := power.IPMI{ ipmiCmd := power.IPMI{
NodeName: node.Id.Get(), NodeName: node.Id.Get(),
HostName: node.IpmiIpaddr.Get(), HostName: node.IpmiIpaddr.Get(),
Port: ipmiPort,
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,

View File

@@ -160,6 +160,11 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
n.IpmiNetmask.Set(SetIpmiNetmask) n.IpmiNetmask.Set(SetIpmiNetmask)
} }
if SetIpmiPort != "" {
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI port to: %s\n", n.Id.Get(), SetIpmiPort)
n.IpmiPort.Set(SetIpmiPort)
}
if SetIpmiGateway != "" { if SetIpmiGateway != "" {
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI gateway to: %s\n", n.Id.Get(), SetIpmiGateway) wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI gateway to: %s\n", n.Id.Get(), SetIpmiGateway)
n.IpmiGateway.Set(SetIpmiGateway) n.IpmiGateway.Set(SetIpmiGateway)

View File

@@ -29,6 +29,7 @@ var (
SetSystemOverlay string SetSystemOverlay string
SetIpmiIpaddr string SetIpmiIpaddr string
SetIpmiNetmask string SetIpmiNetmask string
SetIpmiPort string
SetIpmiGateway string SetIpmiGateway string
SetIpmiUsername string SetIpmiUsername string
SetIpmiPassword string SetIpmiPassword string
@@ -62,10 +63,11 @@ func init() {
baseCmd.PersistentFlags().StringVarP(&SetSystemOverlay, "system", "S", "", "Set the node's system overlay") baseCmd.PersistentFlags().StringVarP(&SetSystemOverlay, "system", "S", "", "Set the node's system overlay")
baseCmd.PersistentFlags().StringVar(&SetIpmiIpaddr, "ipmi", "", "Set the node's IPMI IP address") baseCmd.PersistentFlags().StringVar(&SetIpmiIpaddr, "ipmi", "", "Set the node's IPMI IP address")
baseCmd.PersistentFlags().StringVar(&SetIpmiNetmask, "ipminetmask", "", "Set the node's IPMI netmask") baseCmd.PersistentFlags().StringVar(&SetIpmiNetmask, "ipminetmask", "", "Set the node's IPMI netmask")
baseCmd.PersistentFlags().StringVar(&SetIpmiPort, "ipmiport", "", "Set the node's IPMI port")
baseCmd.PersistentFlags().StringVar(&SetIpmiGateway, "ipmigateway", "", "Set the node's IPMI gateway") baseCmd.PersistentFlags().StringVar(&SetIpmiGateway, "ipmigateway", "", "Set the node's IPMI gateway")
baseCmd.PersistentFlags().StringVar(&SetIpmiUsername, "ipmiuser", "", "Set the node's IPMI username") baseCmd.PersistentFlags().StringVar(&SetIpmiUsername, "ipmiuser", "", "Set the node's IPMI username")
baseCmd.PersistentFlags().StringVar(&SetIpmiPassword, "ipmipass", "", "Set the node's IPMI password") baseCmd.PersistentFlags().StringVar(&SetIpmiPassword, "ipmipass", "", "Set the node's IPMI password")
baseCmd.PersistentFlags().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults to lan if empty)") baseCmd.PersistentFlags().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults to 'lan' if empty)")
baseCmd.PersistentFlags().StringSliceVar(&SetAddProfile, "addprofile", []string{}, "Add Profile(s) to node") baseCmd.PersistentFlags().StringSliceVar(&SetAddProfile, "addprofile", []string{}, "Add Profile(s) to node")
baseCmd.PersistentFlags().StringSliceVar(&SetDelProfile, "delprofile", []string{}, "Remove Profile(s) to node") baseCmd.PersistentFlags().StringSliceVar(&SetDelProfile, "delprofile", []string{}, "Remove Profile(s) to node")

View File

@@ -52,9 +52,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
if node.IpmiInterface.Get() != "" { if node.IpmiInterface.Get() != "" {
ipmiInterface = node.IpmiInterface.Get() ipmiInterface = node.IpmiInterface.Get()
} }
var ipmiPort = "623"
if node.IpmiPort.Get() != "" {
ipmiPort = node.IpmiPort.Get()
}
ipmiCmd := power.IPMI{ ipmiCmd := power.IPMI{
NodeName: node.Id.Get(), NodeName: node.Id.Get(),
HostName: node.IpmiIpaddr.Get(), HostName: node.IpmiIpaddr.Get(),
Port: ipmiPort,
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,

View File

@@ -48,12 +48,21 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
wwlog.Printf(wwlog.ERROR, "%s: No IPMI IP address\n", node.Id.Get()) wwlog.Printf(wwlog.ERROR, "%s: No IPMI IP address\n", node.Id.Get())
continue continue
} }
var ipmiInterface = "lan"
if node.IpmiInterface.Get() != "" {
ipmiInterface = node.IpmiInterface.Get()
}
var ipmiPort = "623"
if node.IpmiPort.Get() != "" {
ipmiPort = node.IpmiPort.Get()
}
ipmiCmd := power.IPMI{ ipmiCmd := power.IPMI{
NodeName: node.Id.Get(), NodeName: node.Id.Get(),
HostName: node.IpmiIpaddr.Get(), HostName: node.IpmiIpaddr.Get(),
Port: ipmiPort,
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface,
AuthType: "MD5", AuthType: "MD5",
} }

View File

@@ -52,9 +52,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
if node.IpmiInterface.Get() != "" { if node.IpmiInterface.Get() != "" {
ipmiInterface = node.IpmiInterface.Get() ipmiInterface = node.IpmiInterface.Get()
} }
var ipmiPort = "623"
if node.IpmiPort.Get() != "" {
ipmiPort = node.IpmiPort.Get()
}
ipmiCmd := power.IPMI{ ipmiCmd := power.IPMI{
NodeName: node.Id.Get(), NodeName: node.Id.Get(),
HostName: node.IpmiIpaddr.Get(), HostName: node.IpmiIpaddr.Get(),
Port: ipmiPort,
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,

View File

@@ -52,9 +52,14 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
if node.IpmiInterface.Get() != "" { if node.IpmiInterface.Get() != "" {
ipmiInterface = node.IpmiInterface.Get() ipmiInterface = node.IpmiInterface.Get()
} }
var ipmiPort = "623"
if node.IpmiPort.Get() != "" {
ipmiPort = node.IpmiPort.Get()
}
ipmiCmd := power.IPMI{ ipmiCmd := power.IPMI{
NodeName: node.Id.Get(), NodeName: node.Id.Get(),
HostName: node.IpmiIpaddr.Get(), HostName: node.IpmiIpaddr.Get(),
Port: ipmiPort,
User: node.IpmiUserName.Get(), User: node.IpmiUserName.Get(),
Password: node.IpmiPassword.Get(), Password: node.IpmiPassword.Get(),
Interface: ipmiInterface, Interface: ipmiInterface,

View File

@@ -43,8 +43,10 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Ipxe", profile.Ipxe.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "Ipxe", profile.Ipxe.Print())
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiIpaddr", profile.IpmiIpaddr.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiIpaddr", profile.IpmiIpaddr.Print())
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiNetmask", profile.IpmiNetmask.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiNetmask", profile.IpmiNetmask.Print())
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiPort", profile.IpmiPort.Print())
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiGateway", profile.IpmiGateway.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiGateway", profile.IpmiGateway.Print())
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiUserName", profile.IpmiUserName.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiUserName", profile.IpmiUserName.Print())
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), "IpmiInterface", profile.IpmiInterface.Print())
for name, netdev := range profile.NetDevs { for name, netdev := range profile.NetDevs {
fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), name+":IPADDR", netdev.Ipaddr.Print()) fmt.Printf("%-20s %-18s %s\n", profile.Id.Get(), name+":IPADDR", netdev.Ipaddr.Print())

View File

@@ -58,7 +58,7 @@ func init() {
baseCmd.PersistentFlags().StringVar(&SetIpmiGateway, "ipmigateway", "", "Set the node's IPMI gateway") baseCmd.PersistentFlags().StringVar(&SetIpmiGateway, "ipmigateway", "", "Set the node's IPMI gateway")
baseCmd.PersistentFlags().StringVar(&SetIpmiUsername, "ipmiuser", "", "Set the node's IPMI username") baseCmd.PersistentFlags().StringVar(&SetIpmiUsername, "ipmiuser", "", "Set the node's IPMI username")
baseCmd.PersistentFlags().StringVar(&SetIpmiPassword, "ipmipass", "", "Set the node's IPMI password") baseCmd.PersistentFlags().StringVar(&SetIpmiPassword, "ipmipass", "", "Set the node's IPMI password")
baseCmd.PersistentFlags().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults to lan if empty)") baseCmd.PersistentFlags().StringVar(&SetIpmiInterface, "ipmiinterface", "", "Set the node's IPMI interface (defaults to 'lan' if empty)")
baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "N", "", "Define the network device to configure") baseCmd.PersistentFlags().StringVarP(&SetNetDev, "netdev", "N", "", "Define the network device to configure")
baseCmd.PersistentFlags().StringVarP(&SetIpaddr, "ipaddr", "I", "", "Set the node's network device IP address") baseCmd.PersistentFlags().StringVarP(&SetIpaddr, "ipaddr", "I", "", "Set the node's network device IP address")

View File

@@ -72,6 +72,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
n.Init.Set(node.Init) n.Init.Set(node.Init)
n.IpmiIpaddr.Set(node.IpmiIpaddr) n.IpmiIpaddr.Set(node.IpmiIpaddr)
n.IpmiNetmask.Set(node.IpmiNetmask) n.IpmiNetmask.Set(node.IpmiNetmask)
n.IpmiPort.Set(node.IpmiPort)
n.IpmiGateway.Set(node.IpmiGateway) n.IpmiGateway.Set(node.IpmiGateway)
n.IpmiUserName.Set(node.IpmiUserName) n.IpmiUserName.Set(node.IpmiUserName)
n.IpmiPassword.Set(node.IpmiPassword) n.IpmiPassword.Set(node.IpmiPassword)
@@ -121,6 +122,7 @@ func (config *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
n.Init.SetAlt(config.NodeProfiles[p].Init, p) n.Init.SetAlt(config.NodeProfiles[p].Init, p)
n.IpmiIpaddr.SetAlt(config.NodeProfiles[p].IpmiIpaddr, p) n.IpmiIpaddr.SetAlt(config.NodeProfiles[p].IpmiIpaddr, p)
n.IpmiNetmask.SetAlt(config.NodeProfiles[p].IpmiNetmask, p) n.IpmiNetmask.SetAlt(config.NodeProfiles[p].IpmiNetmask, p)
n.IpmiPort.SetAlt(config.NodeProfiles[p].IpmiPort, p)
n.IpmiGateway.SetAlt(config.NodeProfiles[p].IpmiGateway, p) n.IpmiGateway.SetAlt(config.NodeProfiles[p].IpmiGateway, p)
n.IpmiUserName.SetAlt(config.NodeProfiles[p].IpmiUserName, p) n.IpmiUserName.SetAlt(config.NodeProfiles[p].IpmiUserName, p)
n.IpmiPassword.SetAlt(config.NodeProfiles[p].IpmiPassword, p) n.IpmiPassword.SetAlt(config.NodeProfiles[p].IpmiPassword, p)
@@ -187,6 +189,7 @@ func (config *nodeYaml) FindAllProfiles() ([]NodeInfo, error) {
p.KernelVersion.Set(profile.KernelVersion) p.KernelVersion.Set(profile.KernelVersion)
p.KernelArgs.Set(profile.KernelArgs) p.KernelArgs.Set(profile.KernelArgs)
p.IpmiNetmask.Set(profile.IpmiNetmask) p.IpmiNetmask.Set(profile.IpmiNetmask)
p.IpmiPort.Set(profile.IpmiPort)
p.IpmiGateway.Set(profile.IpmiGateway) p.IpmiGateway.Set(profile.IpmiGateway)
p.IpmiUserName.Set(profile.IpmiUserName) p.IpmiUserName.Set(profile.IpmiUserName)
p.IpmiPassword.Set(profile.IpmiPassword) p.IpmiPassword.Set(profile.IpmiPassword)

View File

@@ -28,6 +28,7 @@ type NodeConf struct {
IpmiPassword string `yaml:"ipmi password,omitempty"` IpmiPassword string `yaml:"ipmi password,omitempty"`
IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"` IpmiIpaddr string `yaml:"ipmi ipaddr,omitempty"`
IpmiNetmask string `yaml:"ipmi netmask,omitempty"` IpmiNetmask string `yaml:"ipmi netmask,omitempty"`
IpmiPort string `yaml:"ipmi port,omitempty"`
IpmiGateway string `yaml:"ipmi gateway,omitempty"` IpmiGateway string `yaml:"ipmi gateway,omitempty"`
IpmiInterface string `yaml:"ipmi interface,omitempty"` IpmiInterface string `yaml:"ipmi interface,omitempty"`
RuntimeOverlay string `yaml:"runtime overlay,omitempty"` RuntimeOverlay string `yaml:"runtime overlay,omitempty"`
@@ -75,6 +76,7 @@ type NodeInfo struct {
KernelArgs Entry KernelArgs Entry
IpmiIpaddr Entry IpmiIpaddr Entry
IpmiNetmask Entry IpmiNetmask Entry
IpmiPort Entry
IpmiGateway Entry IpmiGateway Entry
IpmiUserName Entry IpmiUserName Entry
IpmiPassword Entry IpmiPassword Entry

View File

@@ -63,6 +63,7 @@ func (config *nodeYaml) NodeUpdate(node NodeInfo) error {
config.Nodes[nodeID].KernelArgs = node.KernelArgs.GetReal() config.Nodes[nodeID].KernelArgs = node.KernelArgs.GetReal()
config.Nodes[nodeID].IpmiIpaddr = node.IpmiIpaddr.GetReal() config.Nodes[nodeID].IpmiIpaddr = node.IpmiIpaddr.GetReal()
config.Nodes[nodeID].IpmiNetmask = node.IpmiNetmask.GetReal() config.Nodes[nodeID].IpmiNetmask = node.IpmiNetmask.GetReal()
config.Nodes[nodeID].IpmiPort = node.IpmiPort.GetReal()
config.Nodes[nodeID].IpmiGateway = node.IpmiGateway.GetReal() config.Nodes[nodeID].IpmiGateway = node.IpmiGateway.GetReal()
config.Nodes[nodeID].IpmiUserName = node.IpmiUserName.GetReal() config.Nodes[nodeID].IpmiUserName = node.IpmiUserName.GetReal()
config.Nodes[nodeID].IpmiPassword = node.IpmiPassword.GetReal() config.Nodes[nodeID].IpmiPassword = node.IpmiPassword.GetReal()
@@ -147,6 +148,7 @@ func (config *nodeYaml) ProfileUpdate(profile NodeInfo) error {
config.NodeProfiles[profileID].KernelArgs = profile.KernelArgs.GetReal() config.NodeProfiles[profileID].KernelArgs = profile.KernelArgs.GetReal()
config.NodeProfiles[profileID].IpmiIpaddr = profile.IpmiIpaddr.GetReal() config.NodeProfiles[profileID].IpmiIpaddr = profile.IpmiIpaddr.GetReal()
config.NodeProfiles[profileID].IpmiNetmask = profile.IpmiNetmask.GetReal() config.NodeProfiles[profileID].IpmiNetmask = profile.IpmiNetmask.GetReal()
config.NodeProfiles[profileID].IpmiPort = profile.IpmiPort.GetReal()
config.NodeProfiles[profileID].IpmiGateway = profile.IpmiGateway.GetReal() config.NodeProfiles[profileID].IpmiGateway = profile.IpmiGateway.GetReal()
config.NodeProfiles[profileID].IpmiUserName = profile.IpmiUserName.GetReal() config.NodeProfiles[profileID].IpmiUserName = profile.IpmiUserName.GetReal()
config.NodeProfiles[profileID].IpmiPassword = profile.IpmiPassword.GetReal() config.NodeProfiles[profileID].IpmiPassword = profile.IpmiPassword.GetReal()

View File

@@ -29,6 +29,7 @@ type TemplateStruct struct {
Root string Root string
IpmiIpaddr string IpmiIpaddr string
IpmiNetmask string IpmiNetmask string
IpmiPort string
IpmiGateway string IpmiGateway string
IpmiUserName string IpmiUserName string
IpmiPassword string IpmiPassword string
@@ -149,6 +150,7 @@ func buildOverlay(nodeList []node.NodeInfo, overlayType string) error {
t.Root = n.Root.Get() t.Root = n.Root.Get()
t.IpmiIpaddr = n.IpmiIpaddr.Get() t.IpmiIpaddr = n.IpmiIpaddr.Get()
t.IpmiNetmask = n.IpmiNetmask.Get() t.IpmiNetmask = n.IpmiNetmask.Get()
t.IpmiPort = n.IpmiPort.Get()
t.IpmiGateway = n.IpmiGateway.Get() t.IpmiGateway = n.IpmiGateway.Get()
t.IpmiUserName = n.IpmiUserName.Get() t.IpmiUserName = n.IpmiUserName.Get()
t.IpmiPassword = n.IpmiPassword.Get() t.IpmiPassword = n.IpmiPassword.Get()

View File

@@ -13,6 +13,7 @@ type IPMIResult struct {
type IPMI struct { type IPMI struct {
NodeName string NodeName string
HostName string HostName string
Port string
User string User string
Password string Password string
AuthType string AuthType string
@@ -29,9 +30,12 @@ func (ipmi *IPMI) Command(ipmiArgs []string) ([]byte, error) {
var args []string var args []string
if ipmi.Interface == "" { if ipmi.Interface == "" {
ipmi.Interface = "lanplus" ipmi.Interface = "lan"
} }
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) if ipmi.Port == "" {
ipmi.Port = "623"
}
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-p", ipmi.Port, "-U", ipmi.User, "-P", ipmi.Password)
args = append(args, ipmiArgs...) args = append(args, ipmiArgs...)
ipmiCmd := exec.Command("ipmitool", args...) ipmiCmd := exec.Command("ipmitool", args...)
return ipmiCmd.CombinedOutput() return ipmiCmd.CombinedOutput()
@@ -44,8 +48,10 @@ func (ipmi *IPMI) InteractiveCommand(ipmiArgs []string) error {
if ipmi.Interface == "" { if ipmi.Interface == "" {
ipmi.Interface = "lan" ipmi.Interface = "lan"
} }
if ipmi.Port == "" {
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-U", ipmi.User, "-P", ipmi.Password) ipmi.Port = "623"
}
args = append(args, "-I", ipmi.Interface, "-H", ipmi.HostName, "-p", ipmi.Port, "-U", ipmi.User, "-P", ipmi.Password)
args = append(args, ipmiArgs...) args = append(args, ipmiArgs...)
ipmiCmd := exec.Command("ipmitool", args...) ipmiCmd := exec.Command("ipmitool", args...)
ipmiCmd.Stdout = os.Stdout ipmiCmd.Stdout = os.Stdout