mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix: non-redfish baremetal might support jnlp console
This commit is contained in:
@@ -163,12 +163,7 @@ func handleBaremetalCdromTask(ctx *Context, bm *baremetal.SBaremetalInstance) {
|
||||
}
|
||||
|
||||
func handleBaremetalJnlpTask(ctx *Context, bm *baremetal.SBaremetalInstance) {
|
||||
cli := bm.GetRedfishCli(ctx)
|
||||
if cli == nil {
|
||||
ctx.ResponseError(httperrors.NewNotSupportedError("Redfish API"))
|
||||
return
|
||||
}
|
||||
jnlp, err := cli.GetConsoleJNLP(ctx)
|
||||
jnlp, err := bm.GetConsoleJNLP(ctx)
|
||||
if err != nil {
|
||||
ctx.ResponseError(errors.Wrap(err, "GetConsoleJNLP"))
|
||||
return
|
||||
|
||||
@@ -64,6 +64,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/util/influxdb"
|
||||
"yunion.io/x/onecloud/pkg/util/procutils"
|
||||
"yunion.io/x/onecloud/pkg/util/redfish"
|
||||
"yunion.io/x/onecloud/pkg/util/redfish/bmconsole"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
"yunion.io/x/onecloud/pkg/util/sysutils"
|
||||
)
|
||||
@@ -1935,6 +1936,23 @@ func (b *SBaremetalInstance) fetchPowerThermalMetrics(ctx context.Context) ([]in
|
||||
return powerMetrics, thermalMetrics, nil
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) GetConsoleJNLP(ctx context.Context) (string, error) {
|
||||
cli := b.GetRedfishCli(ctx)
|
||||
if cli != nil {
|
||||
return cli.GetConsoleJNLP(ctx)
|
||||
}
|
||||
conf := b.GetIPMIConfig()
|
||||
bmc := bmconsole.NewBMCConsole(conf.IpAddr, conf.Username, conf.Password, false)
|
||||
manufacture := b.GetManufacture()
|
||||
switch strings.ToLower(manufacture) {
|
||||
case "hp", "hpe":
|
||||
return bmc.GetIloConsoleJNLP(ctx)
|
||||
case "dell", "dell inc.":
|
||||
return bmc.GetIdracConsoleJNLP(ctx, "", "")
|
||||
}
|
||||
return "", httperrors.NewNotImplementedError("Unsupported manufacture %s", manufacture)
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) getTags() []influxdb.SKeyValue {
|
||||
tags := []influxdb.SKeyValue{
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ func InspurProfile() IPMIProfile {
|
||||
|
||||
func LenovoProfile() IPMIProfile {
|
||||
return IPMIProfile{
|
||||
LanChannel: []int{8},
|
||||
LanChannel: []int{1, 8},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
}
|
||||
@@ -51,7 +51,7 @@ func LenovoProfile() IPMIProfile {
|
||||
|
||||
func HpProfile() IPMIProfile {
|
||||
return IPMIProfile{
|
||||
LanChannel: []int{2},
|
||||
LanChannel: []int{1, 2},
|
||||
RootName: "root",
|
||||
RootId: 1,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user