interface.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package tasks
  15. import (
  16. "context"
  17. "net"
  18. "yunion.io/x/cloudmux/pkg/apis/compute"
  19. "yunion.io/x/jsonutils"
  20. "yunion.io/x/onecloud/pkg/baremetal/pxe"
  21. baremetaltypes "yunion.io/x/onecloud/pkg/baremetal/types"
  22. "yunion.io/x/onecloud/pkg/cloudcommon/types"
  23. "yunion.io/x/onecloud/pkg/mcclient"
  24. "yunion.io/x/onecloud/pkg/util/ssh"
  25. )
  26. type IBaremetal interface {
  27. Keyword() string
  28. GetId() string
  29. GetZoneId() string
  30. GetStorageCacheId() string
  31. GetTaskQueue() *TaskQueue
  32. GetSSHConfig() (*types.SSHConfig, error)
  33. TestSSHConfig() bool
  34. GetAdminNic() *types.SNic
  35. GetName() string
  36. GetClientSession() *mcclient.ClientSession
  37. SaveDesc(ctx context.Context, desc jsonutils.JSONObject) error
  38. GetNics() []types.SNic
  39. GetNicByMac(net.HardwareAddr) *types.SNic
  40. GetRawIPMIConfig() *types.SIPMIInfo
  41. GetIPMINic(mac net.HardwareAddr) *types.SNic
  42. SetExistingIPMIIPAddr(ipAddr string)
  43. GetServer() baremetaltypes.IBaremetalServer
  44. SyncStatus(ctx context.Context, status, reason string)
  45. AutoSyncStatus(ctx context.Context)
  46. SyncAllStatus(ctx context.Context, status types.PowerStatus)
  47. AutoSyncAllStatus(ctx context.Context)
  48. GetPowerStatus() (types.PowerStatus, error)
  49. DoPowerShutdown(soft bool) error
  50. DoPXEBoot() error
  51. // DoDiskBoot() error
  52. DoRedfishPowerOn() error
  53. GetAccessIp() string
  54. EnablePxeBoot() bool
  55. GenerateBootISO() error
  56. SendNicInfo(ctx context.Context, nic *types.SNicDevInfo, idx int, nicType compute.TNicType, reset bool, ipAddr string, reserve bool) error
  57. DoNTPConfig() error
  58. GetImageUrl(needImageCache bool) string
  59. RemoveServer()
  60. InitializeServer(session *mcclient.ClientSession, name string) error
  61. SaveSSHConfig(remoteAddr string, key string) error
  62. ServerLoadDesc(ctx context.Context) error
  63. GetDHCPServerIP() (net.IP, error)
  64. HasBMC() bool
  65. SSHReachable() (bool, error)
  66. SSHReboot(ctx context.Context) error
  67. SSHShutdown() error
  68. AdjustUEFICurrentBootOrder(ctx context.Context, cli *ssh.Client) error
  69. }
  70. type IBmManager interface {
  71. GetZoneId() string
  72. AddBaremetal(context.Context, jsonutils.JSONObject) (pxe.IBaremetalInstance, error)
  73. GetClientSession() *mcclient.ClientSession
  74. }