mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
快照磁盘支持区分公有云私有云
This commit is contained in:
@@ -10,11 +10,13 @@ import (
|
||||
func init() {
|
||||
type SnapshotsListOptions struct {
|
||||
options.BaseListOptions
|
||||
Disk string `help:"Disk snapshots" json:"disk_id"`
|
||||
FakeDeleted bool `help:"Show fake deleted snapshot or not"`
|
||||
Local *bool `help:"Show local snapshots"`
|
||||
Share *bool `help:"Show shared snapshots"`
|
||||
DiskType string `help:"Filter by disk type" choices:"sys|data"`
|
||||
Disk string `help:"Disk snapshots" json:"disk_id"`
|
||||
FakeDeleted bool `help:"Show fake deleted snapshot or not"`
|
||||
Local *bool `help:"Show local snapshots"`
|
||||
Share *bool `help:"Show shared snapshots"`
|
||||
DiskType string `help:"Filter by disk type" choices:"sys|data"`
|
||||
PublicCloud *bool `help:"Show public cloud snapshots"`
|
||||
PrivateCloud *bool `help:"Show private cloud snapshots"`
|
||||
}
|
||||
R(&SnapshotsListOptions{}, "snapshot-list", "Show snapshots", func(s *mcclient.ClientSession, args *SnapshotsListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
|
||||
@@ -118,6 +118,14 @@ func (manager *SSnapshotManager) ListItemFilter(ctx context.Context, q *sqlchemy
|
||||
sqlchemy.In(q.Field("storage_id"), sq)))
|
||||
}
|
||||
|
||||
// if jsonutils.QueryBoolean(query, "public_cloud", false) {
|
||||
// publicRegionIds := CloudregionManager.GetPublicRegionIds()
|
||||
// q = q.Filter(sqlchemy.In(q.Field("cloudregion_id"), publicRegionIds))
|
||||
// } else if jsonutils.QueryBoolean(query, "private_cloud", false) {
|
||||
// privateRegionIds := CloudregionManager.GetPrivateRegionIds()
|
||||
// q = q.Filter(sqlchemy.In(q.Field("cloudregion_id"), privateRegionIds))
|
||||
// }
|
||||
|
||||
if diskType, err := query.GetString("disk_type"); err == nil {
|
||||
diskTbl := DiskManager.Query().SubQuery()
|
||||
sq := diskTbl.Query(diskTbl.Field("id")).Equals("disk_type", diskType).SubQuery()
|
||||
|
||||
@@ -390,7 +390,7 @@ func (instance *SInstance) ChangeConfig(ctx context.Context, ncpu int, vmem int)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return instance.host.zone.region.ChageConfig(instance.ID, flavorId)
|
||||
return instance.host.zone.region.ChangeConfig(instance, flavorId)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -401,12 +401,12 @@ func (instance *SInstance) ChangeConfig2(ctx context.Context, instanceType strin
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return instance.host.zone.region.ChageConfig(instance.ID, flavorId)
|
||||
return instance.host.zone.region.ChangeConfig(instance, flavorId)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (region *SRegion) ChageConfig(instanceId string, flavorId string) error {
|
||||
func (region *SRegion) ChangeConfig(instance *SInstance, flavorId string) error {
|
||||
params := map[string]map[string]string{
|
||||
"resize": {
|
||||
"flavorRef": flavorId,
|
||||
|
||||
@@ -95,7 +95,7 @@ func (self *SQcloudProvider) IsOnPremiseInfrastructure() bool {
|
||||
}
|
||||
|
||||
func (self *SQcloudProvider) SyncSkuFromCloud() bool {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *SQcloudProvider) GetId() string {
|
||||
|
||||
Reference in New Issue
Block a user