options.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 options
  15. import common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
  16. type BaremetalOptions struct {
  17. common_options.CommonOptions
  18. ListenInterface string `help:"Master net interface of baremetal server" default:"br0"`
  19. AccessAddress string `help:"Management IP address of baremetal server, only need to use when multiple address bind to ListenInterface"`
  20. ListenAddress string `help:"PXE serve IP address to select when multiple address bind to ListenInterface"`
  21. TftpRoot string `default:"/opt/cloud/yunion/baremetal" help:"tftp root directory"`
  22. AutoRegisterBaremetal bool `default:"true" help:"Automatically create a baremetal instance"`
  23. BaremetalsPath string `default:"/opt/cloud/workspace/baremetals" help:"Path for baremetals configuration files"`
  24. LinuxDefaultRootUser bool `default:"false" help:"Default account for linux system is root"`
  25. IpmiLanPortShared bool `default:"false" help:"IPMI Lan port shared or dedicated"`
  26. Zone string `help:"Zone where the agent locates"`
  27. DhcpLeaseTime int `default:"100663296" help:"DHCP lease time in seconds"` // 0x6000000
  28. DhcpRenewalTime int `default:"67108864" help:"DHCP renewal time in seconds"` // 0x4000000
  29. EnableGeneralGuestDhcp bool `default:"false" help:"Enable DHCP service for general guest, e.g. those on VMware ESXi or Xen"`
  30. ForceDhcpProbeIpmi bool `default:"false" help:"Force DHCP probe IPMI interface network connection"`
  31. TftpBlockSizeInBytes int `default:"1024" help:"tftp block size, default is 1024"`
  32. TftpMaxTimeoutRetries int `default:"50" help:"Maximal tftp timeout retries, default is 50"`
  33. LengthyWorkerCount int `default:"8" help:"Parallel worker count for lengthy tasks"`
  34. ShortWorkerCount int `default:"8" help:"Parallel worker count for short-lived tasks"`
  35. BaremetalTaskWorkerCount int `default:"32" help:"Parallel worker count for baremetal tasks"`
  36. DefaultIpmiPassword string `help:"Default IPMI passowrd"`
  37. DefaultStrongIpmiPassword string `help:"Default strong IPMI passowrd"`
  38. WindowsDefaultAdminUser bool `default:"true" help:"Default account for Windows system is Administrator"`
  39. // EnableTftpHttpDownload bool `default:"true" help:"Pxelinux download file through http"`
  40. CachePath string `help:"local image cache directory"`
  41. EnablePxeBoot bool `help:"Enable DHCP PXE boot" default:"true"`
  42. BootIsoPath string `help:"iso boot image path"`
  43. StatusProbeIntervalSeconds int `help:"interval to probe baremetal status, default is 60 seconds" default:"60"`
  44. LogFetchIntervalSeconds int `help:"interval to fetch baremetal log, default is 900 seconds" default:"900"`
  45. SendMetricsIntervalSeconds int `help:"interval to send baremetal metrics, default is 300 seconds" default:"300"`
  46. TftpFileMap map[string]string `help:"map of filename to real file path for tftp"`
  47. BootLoader string `help:"PXE boot loader" default:"grub"`
  48. EnableGrubTftpDownload bool `help:"Enable grub using tftp to download kernel and initrd"`
  49. UseMegaRaidPerccli bool `help:"Use MegaRAID perccli" default:"false"`
  50. NfsBootRootfs string `help:"nfs root fs URL"`
  51. TftpBootServer string `help:"customized tftp boot server"`
  52. TftpBootFilename string `help:"filename of tftp boot loader"`
  53. TftpBootFilesize int64 `help:"file size of tftp boot loader"`
  54. }
  55. const (
  56. BOOT_LOADER_SYSLINUX = "syslinux"
  57. BOOT_LOADER_GRUB = "grub"
  58. )
  59. var (
  60. Options BaremetalOptions
  61. )
  62. func OnOptionsChange(oldO, newO interface{}) bool {
  63. oldOpts := oldO.(*BaremetalOptions)
  64. newOpts := newO.(*BaremetalOptions)
  65. changed := false
  66. if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
  67. changed = true
  68. }
  69. return changed
  70. }