Added IpmiGateway in case of separate BMC and control network
This commit is contained in:
@@ -59,6 +59,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Init", node.Init.Source(), node.Init.Print())
|
fmt.Printf("%-20s %-18s %-12s %s\n", node.Id.Get(), "Init", node.Init.Source(), node.Init.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(), "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())
|
||||||
|
|
||||||
for name, netdev := range node.NetDevs {
|
for name, netdev := range node.NetDevs {
|
||||||
|
|||||||
@@ -164,6 +164,16 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if SetIpmiGateway != "" {
|
||||||
|
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI gateway to: %s\n", n.Id.Get(), SetIpmiGateway)
|
||||||
|
|
||||||
|
n.IpmiGateway.Set(SetIpmiGateway)
|
||||||
|
err := nodeDB.NodeUpdate(n)
|
||||||
|
if err != nil {
|
||||||
|
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
if SetIpmiUsername != "" {
|
if SetIpmiUsername != "" {
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI IP username to: %s\n", n.Id.Get(), SetIpmiUsername)
|
wwlog.Printf(wwlog.VERBOSE, "Node: %s, Setting IPMI IP username to: %s\n", n.Id.Get(), SetIpmiUsername)
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ var (
|
|||||||
SetSystemOverlay string
|
SetSystemOverlay string
|
||||||
SetIpmiIpaddr string
|
SetIpmiIpaddr string
|
||||||
SetIpmiNetmask string
|
SetIpmiNetmask string
|
||||||
|
SetIpmiGateway string
|
||||||
SetIpmiUsername string
|
SetIpmiUsername string
|
||||||
SetIpmiPassword string
|
SetIpmiPassword string
|
||||||
SetNodeAll bool
|
SetNodeAll bool
|
||||||
@@ -45,6 +46,7 @@ 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(&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")
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ 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(), "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())
|
||||||
|
|
||||||
for name, netdev := range profile.NetDevs {
|
for name, netdev := range profile.NetDevs {
|
||||||
|
|||||||
@@ -159,6 +159,16 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if SetIpmiGateway != "" {
|
||||||
|
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting IPMI username to: %s\n", p.Id, SetIpmiGateway)
|
||||||
|
|
||||||
|
p.IpmiGateway.Set(SetIpmiGateway)
|
||||||
|
err := nodeDB.ProfileUpdate(p)
|
||||||
|
if err != nil {
|
||||||
|
wwlog.Printf(wwlog.ERROR, "%s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
if SetIpmiUsername != "" {
|
if SetIpmiUsername != "" {
|
||||||
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting IPMI username to: %s\n", p.Id, SetIpmiUsername)
|
wwlog.Printf(wwlog.VERBOSE, "Profile: %s, Setting IPMI username to: %s\n", p.Id, SetIpmiUsername)
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ var (
|
|||||||
SetRuntimeOverlay string
|
SetRuntimeOverlay string
|
||||||
SetSystemOverlay string
|
SetSystemOverlay string
|
||||||
SetIpmiNetmask string
|
SetIpmiNetmask string
|
||||||
|
SetIpmiGateway string
|
||||||
SetIpmiUsername string
|
SetIpmiUsername string
|
||||||
SetIpmiPassword string
|
SetIpmiPassword string
|
||||||
SetNetDev string
|
SetNetDev string
|
||||||
@@ -41,6 +42,7 @@ func init() {
|
|||||||
baseCmd.PersistentFlags().StringVarP(&SetRuntimeOverlay, "runtime", "R", "", "Set the node's runtime overlay")
|
baseCmd.PersistentFlags().StringVarP(&SetRuntimeOverlay, "runtime", "R", "", "Set the node's runtime overlay")
|
||||||
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(&SetIpmiNetmask, "ipminetmask", "", "Set the node's IPMI netmask")
|
baseCmd.PersistentFlags().StringVar(&SetIpmiNetmask, "ipminetmask", "", "Set the node's IPMI netmask")
|
||||||
|
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")
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ func (self *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.IpmiGateway.Set(node.IpmiGateway)
|
||||||
n.IpmiUserName.Set(node.IpmiUserName)
|
n.IpmiUserName.Set(node.IpmiUserName)
|
||||||
n.IpmiPassword.Set(node.IpmiPassword)
|
n.IpmiPassword.Set(node.IpmiPassword)
|
||||||
n.SystemOverlay.Set(node.SystemOverlay)
|
n.SystemOverlay.Set(node.SystemOverlay)
|
||||||
@@ -106,6 +107,7 @@ func (self *nodeYaml) FindAllNodes() ([]NodeInfo, error) {
|
|||||||
n.Init.SetAlt(self.NodeProfiles[p].Init, pstring)
|
n.Init.SetAlt(self.NodeProfiles[p].Init, pstring)
|
||||||
n.IpmiIpaddr.SetAlt(self.NodeProfiles[p].IpmiIpaddr, pstring)
|
n.IpmiIpaddr.SetAlt(self.NodeProfiles[p].IpmiIpaddr, pstring)
|
||||||
n.IpmiNetmask.SetAlt(self.NodeProfiles[p].IpmiNetmask, pstring)
|
n.IpmiNetmask.SetAlt(self.NodeProfiles[p].IpmiNetmask, pstring)
|
||||||
|
n.IpmiGateway.SetAlt(self.NodeProfiles[p].IpmiGateway, pstring)
|
||||||
n.IpmiUserName.SetAlt(self.NodeProfiles[p].IpmiUserName, pstring)
|
n.IpmiUserName.SetAlt(self.NodeProfiles[p].IpmiUserName, pstring)
|
||||||
n.IpmiPassword.SetAlt(self.NodeProfiles[p].IpmiPassword, pstring)
|
n.IpmiPassword.SetAlt(self.NodeProfiles[p].IpmiPassword, pstring)
|
||||||
n.SystemOverlay.SetAlt(self.NodeProfiles[p].SystemOverlay, pstring)
|
n.SystemOverlay.SetAlt(self.NodeProfiles[p].SystemOverlay, pstring)
|
||||||
@@ -149,6 +151,7 @@ func (self *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.IpmiGateway.Set(profile.IpmiGateway)
|
||||||
p.IpmiUserName.Set(profile.IpmiUserName)
|
p.IpmiUserName.Set(profile.IpmiUserName)
|
||||||
p.IpmiPassword.Set(profile.IpmiPassword)
|
p.IpmiPassword.Set(profile.IpmiPassword)
|
||||||
p.RuntimeOverlay.Set(profile.RuntimeOverlay)
|
p.RuntimeOverlay.Set(profile.RuntimeOverlay)
|
||||||
|
|||||||
@@ -27,6 +27,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"`
|
||||||
|
IpmiGateway string `yaml:"ipmi gateway,omitempty"`
|
||||||
RuntimeOverlay string `yaml:"runtime overlay files,omitempty"`
|
RuntimeOverlay string `yaml:"runtime overlay files,omitempty"`
|
||||||
SystemOverlay string `yaml:"system overlay files,omitempty"`
|
SystemOverlay string `yaml:"system overlay files,omitempty"`
|
||||||
Init string `yaml:"init,omitempty"`
|
Init string `yaml:"init,omitempty"`
|
||||||
@@ -67,6 +68,7 @@ type NodeInfo struct {
|
|||||||
KernelArgs Entry
|
KernelArgs Entry
|
||||||
IpmiIpaddr Entry
|
IpmiIpaddr Entry
|
||||||
IpmiNetmask Entry
|
IpmiNetmask Entry
|
||||||
|
IpmiGateway Entry
|
||||||
IpmiUserName Entry
|
IpmiUserName Entry
|
||||||
IpmiPassword Entry
|
IpmiPassword Entry
|
||||||
RuntimeOverlay Entry
|
RuntimeOverlay Entry
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ func (self *nodeYaml) NodeUpdate(node NodeInfo) error {
|
|||||||
self.Nodes[nodeID].KernelArgs = node.KernelArgs.GetReal()
|
self.Nodes[nodeID].KernelArgs = node.KernelArgs.GetReal()
|
||||||
self.Nodes[nodeID].IpmiIpaddr = node.IpmiIpaddr.GetReal()
|
self.Nodes[nodeID].IpmiIpaddr = node.IpmiIpaddr.GetReal()
|
||||||
self.Nodes[nodeID].IpmiNetmask = node.IpmiNetmask.GetReal()
|
self.Nodes[nodeID].IpmiNetmask = node.IpmiNetmask.GetReal()
|
||||||
|
self.Nodes[nodeID].IpmiGateway = node.IpmiGateway.GetReal()
|
||||||
self.Nodes[nodeID].IpmiUserName = node.IpmiUserName.GetReal()
|
self.Nodes[nodeID].IpmiUserName = node.IpmiUserName.GetReal()
|
||||||
self.Nodes[nodeID].IpmiPassword = node.IpmiPassword.GetReal()
|
self.Nodes[nodeID].IpmiPassword = node.IpmiPassword.GetReal()
|
||||||
self.Nodes[nodeID].RuntimeOverlay = node.RuntimeOverlay.GetReal()
|
self.Nodes[nodeID].RuntimeOverlay = node.RuntimeOverlay.GetReal()
|
||||||
@@ -134,6 +135,7 @@ func (self *nodeYaml) ProfileUpdate(profile NodeInfo) error {
|
|||||||
self.NodeProfiles[profileID].KernelArgs = profile.KernelArgs.GetReal()
|
self.NodeProfiles[profileID].KernelArgs = profile.KernelArgs.GetReal()
|
||||||
self.NodeProfiles[profileID].IpmiIpaddr = profile.IpmiIpaddr.GetReal()
|
self.NodeProfiles[profileID].IpmiIpaddr = profile.IpmiIpaddr.GetReal()
|
||||||
self.NodeProfiles[profileID].IpmiNetmask = profile.IpmiNetmask.GetReal()
|
self.NodeProfiles[profileID].IpmiNetmask = profile.IpmiNetmask.GetReal()
|
||||||
|
self.NodeProfiles[profileID].IpmiGateway = profile.IpmiGateway.GetReal()
|
||||||
self.NodeProfiles[profileID].IpmiUserName = profile.IpmiUserName.GetReal()
|
self.NodeProfiles[profileID].IpmiUserName = profile.IpmiUserName.GetReal()
|
||||||
self.NodeProfiles[profileID].IpmiPassword = profile.IpmiPassword.GetReal()
|
self.NodeProfiles[profileID].IpmiPassword = profile.IpmiPassword.GetReal()
|
||||||
self.NodeProfiles[profileID].RuntimeOverlay = profile.RuntimeOverlay.GetReal()
|
self.NodeProfiles[profileID].RuntimeOverlay = profile.RuntimeOverlay.GetReal()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type TemplateStruct struct {
|
|||||||
Init string
|
Init string
|
||||||
IpmiIpaddr string
|
IpmiIpaddr string
|
||||||
IpmiNetmask string
|
IpmiNetmask string
|
||||||
|
IpmiGateway string
|
||||||
IpmiUserName string
|
IpmiUserName string
|
||||||
IpmiPassword string
|
IpmiPassword string
|
||||||
NetDevs map[string]*node.NetDevs
|
NetDevs map[string]*node.NetDevs
|
||||||
@@ -136,6 +137,7 @@ func buildOverlay(nodeList []node.NodeInfo, overlayType string) error {
|
|||||||
t.Init = n.Init.Get()
|
t.Init = n.Init.Get()
|
||||||
t.IpmiIpaddr = n.IpmiIpaddr.Get()
|
t.IpmiIpaddr = n.IpmiIpaddr.Get()
|
||||||
t.IpmiNetmask = n.IpmiNetmask.Get()
|
t.IpmiNetmask = n.IpmiNetmask.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()
|
||||||
t.NetDevs = make(map[string]*node.NetDevs)
|
t.NetDevs = make(map[string]*node.NetDevs)
|
||||||
|
|||||||
@@ -7,9 +7,13 @@ error_exit() {
|
|||||||
|
|
||||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
IP="{{$.IpmiIpaddr}}"
|
IP="{{$.IpmiIpaddr}}"
|
||||||
NETMASK="{{$.NetDevs.eth0.Netmask}}"
|
NETMASK="{{$.IpmiNetmask}}"
|
||||||
GATEWAY="{{$.NetDevs.eth0.Gateway}}"
|
[ -z "$NETMASK" ] && NETMASK="{{$.NetDevs.eth0.Netmask}}"
|
||||||
|
GATEWAY="{{$.IpmiGateway}}"
|
||||||
|
[ -z "$GATEWAY" ] && GATEWAY="{{$.NetDevs.eth0.Gateway}}"
|
||||||
USER="{{$.IpmiUserName}}"
|
USER="{{$.IpmiUserName}}"
|
||||||
PASS="{{$.IpmiPassword}}"
|
PASS="{{$.IpmiPassword}}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user