Skip to content

Commit

Permalink
Merge pull request #18786 from swordqiu/automated-cherry-pick-of-#187…
Browse files Browse the repository at this point in the history
…84-upstream-master

Automated cherry pick of #18784: feature: backup support object storage
  • Loading branch information
zexi authored Nov 26, 2023
2 parents c5e8856 + 33ac7b1 commit 26454ff
Show file tree
Hide file tree
Showing 43 changed files with 1,717 additions and 619 deletions.
1 change: 1 addition & 0 deletions cmd/climc/shell/compute/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func init() {
bsCmd.List(&compute.BackupStorageListOptions{})
bsCmd.Show(&compute.BackupStorageIdOptions{})
bsCmd.Create(&compute.BackupStorageCreateOptions{})
bsCmd.Update(&compute.BackupStorageUpdateOptions{})
bsCmd.Delete(&compute.BackupStorageIdOptions{})
bsCmd.Perform("public", &options.BasePublicOptions{})
bsCmd.Perform("private", &options.BaseIdOptions{})
Expand Down
53 changes: 41 additions & 12 deletions pkg/apis/compute/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ import (
"yunion.io/x/onecloud/pkg/apis"
)

type TBackupStorageType string

const (
BACKUPSTORAGE_TYPE_NFS = "nfs"
BACKUPSTORAGE_TYPE_NFS = TBackupStorageType("nfs")
BACKUPSTORAGE_TYPE_OBJECT_STORAGE = TBackupStorageType("object")

BACKUPSTORAGE_STATUS_ONLINE = "online"
BACKUPSTORAGE_STATUS_OFFLINE = "offline"

Expand Down Expand Up @@ -55,27 +59,26 @@ type BackupStorageCreateInput struct {
// enum: nfs
StorageType string `json:"storage_type"`

// description: host of nfs, storage_type 为 nfs 时, 此参数必传
// example: 192.168.222.2
NfsHost string `json:"nfs_host"`

// description: shared dir of nfs, storage_type 为 nfs 时, 此参数必传
// example: /nfs_root/
NfsSharedDir string `json:"nfs_shared_dir"`
SBackupStorageAccessInfo

// description: Capacity size in MB
CapacityMb int `json:"capacity_mb"`
}

type BackupStorageAccessInfo struct {
AccessUrl string
type BackupStorageUpdateInput struct {
apis.EnabledStatusInfrasResourceBaseUpdateInput

SBackupStorageAccessInfo
}

/*type BackupStorageAccessInfo struct {
AccessUrl string
}*/

type BackupStorageDetails struct {
apis.EnabledStatusInfrasResourceBaseDetails

NfsHost string
NfsSharedDir string
SBackupStorageAccessInfo
}

type BackupStorageListInput struct {
Expand Down Expand Up @@ -162,3 +165,29 @@ type InstanceBackupPackMetadata struct {

type InstanceBackupManagerSyncstatusInput struct {
}

type SBackupStorageAccessInfo struct {
// description: host of nfs, storage_type 为 nfs 时, 此参数必传
// example: 192.168.222.2
NfsHost string `json:"nfs_host"`

// description: shared dir of nfs, storage_type 为 nfs 时, 此参数必传
// example: /nfs_root/
NfsSharedDir string `json:"nfs_shared_dir"`

// description: access url of object storage bucket
// example: https://qxxxxxo.tos-cn-beijing.volces.com
ObjectBucketUrl string `json:"object_bucket_url"`
// description: access key of object storage
ObjectAccessKey string `json:"object_access_key"`
// description: secret of object storage
ObjectSecret string `json:"object_secret"`
}

func (ba *SBackupStorageAccessInfo) String() string {
return jsonutils.Marshal(ba).String()
}

func (ba *SBackupStorageAccessInfo) IsZero() bool {
return ba == nil
}
8 changes: 8 additions & 0 deletions pkg/apis/compute/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ package compute

import (
"net/http"
"reflect"

"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/gotypes"
"yunion.io/x/pkg/util/regutils"
"yunion.io/x/pkg/utils"

Expand Down Expand Up @@ -360,3 +362,9 @@ type BucketRefererConf struct {
func (input *BucketRefererConf) Validate() error {
return nil
}

func init() {
gotypes.RegisterSerializable(reflect.TypeOf(&SBackupStorageAccessInfo{}), func() gotypes.ISerializable {
return &SBackupStorageAccessInfo{}
})
}
43 changes: 0 additions & 43 deletions pkg/apis/compute/dnstrafficpolicy.go

This file was deleted.

46 changes: 0 additions & 46 deletions pkg/apis/compute/dnszonecache.go

This file was deleted.

2 changes: 0 additions & 2 deletions pkg/apis/compute/guests.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ type ServerListInput struct {
// 列出操作系统为指定值的主机
// enum: linux,windows,vmware
OsType []string `json:"os_type"`
// 操作系统发行版
OsDist []string `json:"os_dist"`

// 对列表结果按照磁盘大小进行排序
// enum: asc,desc
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/compute/hostwire.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package compute
type HostwireDetails struct {
HostJointResourceDetails

SHostwire
SHostwireDeprecated

// 二层网络名称
Wire string `json:"wire"`
Expand Down
Loading

0 comments on commit 26454ff

Please sign in to comment.