guest_import_api.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 compute
  15. const (
  16. SERVER_META_CONVERT_FROM_ESXI = "__server_convert_from_esxi"
  17. SERVER_META_CONVERT_FROM_CLOUDPODS = "__server_convert_from_cloudpods"
  18. SERVER_META_CONVERTED_SERVER = "__server_converted_to"
  19. DISK_META_REMOTE_ACCESS_PATH = "__remote_access_path"
  20. )
  21. type SImportNic struct {
  22. Index int `json:"index"`
  23. Bridge string `json:"bridge"`
  24. Domain string `json:"domain"`
  25. Ip string `json:"ip"`
  26. Vlan int `json:"vlan"`
  27. Driver string `json:"driver"`
  28. Masklen int `json:"masklen"`
  29. Virtual bool `json:"virtual"`
  30. Manual bool `json:"manual"`
  31. WireId string `json:"wire_id"`
  32. NetId string `json:"net_id"`
  33. Mac string `json:"mac"`
  34. BandWidth int `json:"bw"`
  35. Dns string `json:"dns"`
  36. Net string `json:"net"`
  37. Interface string `json:"interface"`
  38. Gateway string `json:"gateway"`
  39. Ifname string `json:"ifname"`
  40. }
  41. type SImportDisk struct {
  42. Index int `json:"index"`
  43. DiskId string `json:"disk_id"`
  44. Driver string `json:"driver"`
  45. CacheMode string `json:"cache_mode"`
  46. AioMode string `json:"aio_mode"`
  47. SizeMb int `json:"size"`
  48. Format string `json:"format"`
  49. Fs string `json:"fs"`
  50. Mountpoint string `json:"mountpoint"`
  51. Dev string `json:"dev"`
  52. TemplateId string `json:"template_id"`
  53. AccessPath string `json:"AccessPath"`
  54. Backend string `json:"Backend"`
  55. }
  56. type SImportGuestDesc struct {
  57. Id string `json:"uuid"`
  58. Name string `json:"name"`
  59. Nics []SImportNic `json:"nics"`
  60. Disks []SImportDisk `json:"disks"`
  61. Metadata map[string]string `json:"metadata"`
  62. MemSizeMb int `json:"mem"`
  63. Cpu int `json:"cpu"`
  64. TemplateId string `json:"template_id"`
  65. ImagePath string `json:"image_path"`
  66. Vdi string `json:"vdi"`
  67. Hypervisor string `json:"hypervisor"`
  68. HostId string `json:"host"`
  69. BootOrder string `json:"boot_order"`
  70. IsSystem bool `json:"is_system"`
  71. Description string `json:"description"`
  72. MonitorPath string `json:"monitor_path"`
  73. }
  74. type SLibvirtServerConfig struct {
  75. MacIp map[string]string `json:"mac_ip"`
  76. }
  77. type SLibvirtHostConfig struct {
  78. Servers []SLibvirtServerConfig `json:"servers"`
  79. XmlFilePath string `json:"xml_file_path"`
  80. MonitorPath string `json:"monitor_path"`
  81. HostIp string `json:"host_ip"`
  82. }
  83. type SLibvirtImportConfig struct {
  84. Hosts []SLibvirtHostConfig `json:"hosts"`
  85. }