storagehelper.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 storageman
  15. import (
  16. "fmt"
  17. "yunion.io/x/jsonutils"
  18. "yunion.io/x/onecloud/pkg/apis"
  19. api "yunion.io/x/onecloud/pkg/apis/compute"
  20. deployapi "yunion.io/x/onecloud/pkg/hostman/hostdeployer/apis"
  21. "yunion.io/x/onecloud/pkg/mcclient"
  22. )
  23. type SDiskCreateByDiskinfo struct {
  24. DiskId string
  25. Disk IDisk
  26. DiskInfo api.DiskAllocateInput
  27. Storage IStorage
  28. }
  29. func (i *SDiskCreateByDiskinfo) String() string {
  30. return fmt.Sprintf("disk_id: %s, disk_info: %s", i.DiskId, jsonutils.Marshal(i.DiskInfo))
  31. }
  32. type SDiskMigrate struct {
  33. DiskId string
  34. Disk IDisk
  35. SrcStorageId string
  36. TemplateId string
  37. OutChainSnaps []jsonutils.JSONObject
  38. SnapsChain []jsonutils.JSONObject
  39. DiskBackingFile string
  40. SnapshotsUri string
  41. DiskUri string
  42. SysDiskHasTemplate bool
  43. Storage IStorage
  44. }
  45. type SDiskReset struct {
  46. SnapshotId string
  47. BackingDiskId string
  48. Input jsonutils.JSONObject
  49. }
  50. type SDiskCleanupSnapshots struct {
  51. ConvertSnapshots []jsonutils.JSONObject
  52. DeleteSnapshots []jsonutils.JSONObject
  53. }
  54. type SStorageDeleteSnapshots struct {
  55. DiskId string
  56. SnapshotIds []string
  57. }
  58. type SStorageDeleteSnapshot struct {
  59. DiskId string
  60. SnapshotId string
  61. ConvertSnapshot string
  62. BlockStream bool
  63. EncryptInfo apis.SEncryptInfo
  64. }
  65. type SDiskBackup struct {
  66. SnapshotId string `json:"snapshot_id"`
  67. SnapshotLocation string `json:"snapshot_location"`
  68. BackupId string `json:"backup_id"`
  69. BackupStorageId string `json:"backup_storage_id"`
  70. BackupStorageAccessInfo *jsonutils.JSONDict `json:"backup_storage_access_info"`
  71. EncryptKeyId string `json:"encrypt_key_id"`
  72. UserCred mcclient.TokenCredential
  73. }
  74. type SStorageBackup struct {
  75. BackupId string
  76. BackupLocalPath string
  77. BackupStorageId string
  78. BackupStorageAccessInfo *jsonutils.JSONDict
  79. }
  80. type SStoragePackBackup struct {
  81. PackageName string
  82. BackupId string
  83. BackupStorageId string
  84. BackupStorageAccessInfo *jsonutils.JSONDict
  85. Metadata api.DiskBackupPackMetadata
  86. }
  87. type SStoragePackInstanceBackup struct {
  88. PackageName string
  89. BackupStorageId string
  90. BackupStorageAccessInfo *jsonutils.JSONDict
  91. BackupIds []string
  92. Metadata api.InstanceBackupPackMetadata
  93. }
  94. type SStorageUnpackInstanceBackup struct {
  95. PackageName string
  96. BackupStorageId string
  97. BackupStorageAccessInfo *jsonutils.JSONDict
  98. MetadataOnly *bool
  99. }
  100. type SStorageSaveToGlanceInfo struct {
  101. UserCred mcclient.TokenCredential
  102. DiskInfo *jsonutils.JSONDict
  103. }
  104. type SDiskResizeInput struct {
  105. DiskInfo jsonutils.JSONObject
  106. GuestDesc *deployapi.GuestDesc
  107. }