models

package
v0.3.11-8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2024 License: Apache-2.0 Imports: 57 Imported by: 3

Documentation

Index

Constants

View Source
const (
	FileNoExists sUnactiveReason = iota
	FileSizeMismatch
	FileChecksumMismatch
	Others
)
View Source
const (
	LocalFilePrefix = api.LocalFilePrefix
)

Variables

View Source
var (
	ImageQuota               SQuota
	QuotaManager             *SQuotaManager
	QuotaUsageManager        *SQuotaManager
	QuotaPendingUsageManager *SQuotaManager
)

Functions

func CheckImages

func CheckImages()

func GetImage

func GetImage(ctx context.Context, location string) (int64, io.ReadCloser, error)

func Init

func Init(storageBackend string)

func InitDB

func InitDB() error

func IsCheckStatusEnabled

func IsCheckStatusEnabled(img *SImage) bool

func RemoveImage

func RemoveImage(ctx context.Context, location string) error

func UpdateImageConfigTargetImageFormats

func UpdateImageConfigTargetImageFormats(ctx context.Context, userCred mcclient.TokenCredential) error

Types

type LocalStorage

type LocalStorage struct{}

func (*LocalStorage) CleanTempfile

func (s *LocalStorage) CleanTempfile(filePath string) error

func (*LocalStorage) ConvertImage

func (s *LocalStorage) ConvertImage(ctx context.Context, image *SImage, targetFormat string) (*SConverImageInfo, error)

func (*LocalStorage) GetImage

func (s *LocalStorage) GetImage(ctx context.Context, imagePath string) (int64, io.ReadCloser, error)

func (*LocalStorage) IsCheckStatusEnabled

func (s *LocalStorage) IsCheckStatusEnabled() bool

func (*LocalStorage) RemoveImage

func (s *LocalStorage) RemoveImage(ctx context.Context, imagePath string) error

func (*LocalStorage) SaveImage

func (s *LocalStorage) SaveImage(ctx context.Context, imagePath string) (string, error)

func (*LocalStorage) Type

func (s *LocalStorage) Type() string

type S3Storage

type S3Storage struct{}

func (*S3Storage) CleanTempfile

func (s *S3Storage) CleanTempfile(filePath string) error

func (*S3Storage) ConvertImage

func (s *S3Storage) ConvertImage(ctx context.Context, image *SImage, targetFormat string) (*SConverImageInfo, error)

func (*S3Storage) GetImage

func (s *S3Storage) GetImage(ctx context.Context, imagePath string) (int64, io.ReadCloser, error)

func (*S3Storage) IsCheckStatusEnabled

func (s *S3Storage) IsCheckStatusEnabled() bool

func (*S3Storage) RemoveImage

func (s *S3Storage) RemoveImage(ctx context.Context, fileName string) error

func (*S3Storage) SaveImage

func (s *S3Storage) SaveImage(ctx context.Context, imagePath string) (string, error)

func (*S3Storage) Type

func (s *S3Storage) Type() string

type SConverImageInfo

type SConverImageInfo struct {
	Location  string
	SizeBytes int64
}

type SGuestImage

type SGuestImage struct {
	db.SSharableVirtualResourceBase
	db.SMultiArchResourceBase
	db.SEncryptedResource

	Protected tristate.TriState `default:"true" list:"user" get:"user" create:"optional" update:"user"`
}

func (*SGuestImage) CustomizeCreate

func (*SGuestImage) CustomizeDelete

func (gi *SGuestImage) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential,
	query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SGuestImage) Delete

func (gi *SGuestImage) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SGuestImage) DoCancelPendingDelete

func (gi *SGuestImage) DoCancelPendingDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SGuestImage) GetUsages

func (gi *SGuestImage) GetUsages() []db.IUsage

func (*SGuestImage) PerformCancelDelete

func (gi *SGuestImage) PerformCancelDelete(ctx context.Context, userCred mcclient.TokenCredential,
	query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SGuestImage) PerformPrivate

func (self *SGuestImage) PerformPrivate(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	input apis.PerformPrivateInput,
) (jsonutils.JSONObject, error)

func (*SGuestImage) PerformPublic

func (*SGuestImage) PerformSetClassMetadata

func (*SGuestImage) PostCreate

func (*SGuestImage) PostUpdate

func (self *SGuestImage) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject,
	data jsonutils.JSONObject)

func (*SGuestImage) RealDelete

func (gi *SGuestImage) RealDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SGuestImage) UpdateSubImage

func (self *SGuestImage) UpdateSubImage(ctx context.Context, userCred mcclient.TokenCredential,
	data jsonutils.JSONObject) error

func (*SGuestImage) ValidateDeleteCondition

func (gi *SGuestImage) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error

type SGuestImageJoint

type SGuestImageJoint struct {
	db.SJointResourceBase

	GuestImageId string `width:"128" charset:"ascii" create:"required"`
	ImageId      string `width:"128" charset:"ascii" create:"required"`
}

func (*SGuestImageJoint) GetId

func (gt *SGuestImageJoint) GetId() string

func (*SGuestImageJoint) RealDelete

func (gt *SGuestImageJoint) RealDelete(ctx context.Context, userCred mcclient.TokenCredential) error

type SGuestImageJointManager

type SGuestImageJointManager struct {
	db.SJointResourceBaseManager
}

+onecloud:swagger-gen-ignore

var GuestImageJointManager *SGuestImageJointManager

func (*SGuestImageJointManager) CreateGuestImageJoint

func (gt *SGuestImageJointManager) CreateGuestImageJoint(ctx context.Context, guestImageId,
	imageId string) (*SGuestImageJoint, error)

func (*SGuestImageJointManager) GetByGuestImageId

func (gm *SGuestImageJointManager) GetByGuestImageId(guestImageId string) ([]SGuestImageJoint, error)

func (*SGuestImageJointManager) GetByImageId

func (gm *SGuestImageJointManager) GetByImageId(imageId string) ([]SGuestImageJoint, error)

func (*SGuestImageJointManager) GetImagesByFilter

func (gm *SGuestImageJointManager) GetImagesByFilter(guestImageId string,
	filter func(q *sqlchemy.SQuery) *sqlchemy.SQuery) ([]SImage, error)

func (*SGuestImageJointManager) GetImagesByGuestImageId

func (gm *SGuestImageJointManager) GetImagesByGuestImageId(guestImageId string) ([]SImage, error)

type SGuestImageManager

var GuestImageManager *SGuestImageManager

func (*SGuestImageManager) CleanPendingDeleteImages

func (self *SGuestImageManager) CleanPendingDeleteImages(ctx context.Context, userCred mcclient.TokenCredential,
	isStart bool)

func (*SGuestImageManager) FetchCustomizeColumns

func (manager *SGuestImageManager) FetchCustomizeColumns(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	objs []interface{},
	fields stringutils2.SSortedStrings,
	isList bool,
) []api.GuestImageDetails

func (*SGuestImageManager) ListItemFilter

func (manager *SGuestImageManager) ListItemFilter(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query api.GuestImageListInput,
) (*sqlchemy.SQuery, error)

主机镜像列表

func (*SGuestImageManager) OrderByExtraFields

func (manager *SGuestImageManager) OrderByExtraFields(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query api.GuestImageListInput,
) (*sqlchemy.SQuery, error)

func (*SGuestImageManager) QueryDistinctExtraField

func (manager *SGuestImageManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SGuestImageManager) Usage

func (manager *SGuestImageManager) Usage(ctx context.Context, scope rbacscope.TRbacScope, ownerId mcclient.IIdentityProvider, prefix string, policyResult rbacutils.SPolicyResult) map[string]int64

func (*SGuestImageManager) ValidateCreateData

type SImage

type SImage struct {
	db.SSharableVirtualResourceBase
	db.SMultiArchResourceBase
	db.SEncryptedResource

	// 镜像大小, 单位Byte
	Size int64 `nullable:"true" list:"user" create:"optional"`
	// 存储地址
	Location string `nullable:"true" list:"user"`

	// 镜像格式
	DiskFormat string `width:"20" charset:"ascii" nullable:"true" list:"user" create:"optional" default:"raw"`
	// 校验和
	Checksum string `width:"32" charset:"ascii" nullable:"true" get:"user" list:"user"`
	FastHash string `width:"32" charset:"ascii" nullable:"true" get:"user"`
	// 用户Id
	Owner string `width:"255" charset:"ascii" nullable:"true" get:"user"`
	// 最小系统盘要求
	MinDiskMB int32 `name:"min_disk" nullable:"false" default:"0" list:"user" create:"optional" update:"user"`
	// 最小内存要求
	MinRamMB int32 `name:"min_ram" nullable:"false" default:"0" list:"user" create:"optional" update:"user"`

	// 是否有删除保护
	Protected tristate.TriState `default:"true" list:"user" get:"user" create:"optional" update:"user"`
	// 是否是标准镜像
	IsStandard tristate.TriState `default:"false" list:"user" get:"user" create:"admin_optional" update:"user"`
	// 是否是主机镜像
	IsGuestImage tristate.TriState `default:"false" create:"optional" list:"user"`
	// 是否是数据盘镜像
	IsData tristate.TriState `default:"false" create:"optional" list:"user" update:"user"`

	// image copy from url, save origin checksum before probe
	// 从镜像时长导入的镜像校验和
	OssChecksum string `width:"32" charset:"ascii" nullable:"true" get:"user" list:"user"`

	// 加密状态, "",encrypting,encrypted
	EncryptStatus string `width:"16" charset:"ascii" nullable:"true" get:"user" list:"user"`
}

+------------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+--------------+------+-----+---------+-------+ | id | varchar(36) | NO | PRI | NULL | | | name | varchar(255) | YES | | NULL | | | size | bigint(20) | YES | | NULL | | | status | varchar(30) | NO | | NULL | | | is_public | tinyint(1) | NO | MUL | NULL | | | location | text | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | YES | | NULL | | | deleted_at | datetime | YES | | NULL | | | deleted | tinyint(1) | NO | MUL | NULL | | | parent_id | varchar(36) | YES | | NULL | | | disk_format | varchar(20) | YES | | NULL | | | container_format | varchar(20) | YES | | NULL | | | checksum | varchar(32) | YES | | NULL | | | owner | varchar(255) | YES | | NULL | | | min_disk | int(11) | NO | | NULL | | | min_ram | int(11) | NO | | NULL | | | protected | tinyint(1) | YES | | NULL | | | description | varchar(256) | YES | | NULL | | +------------------+--------------+------+-----+---------+-------+

func (*SImage) AllowDeleteItem

func (self *SImage) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool

func (*SImage) CanUpdate

func (self *SImage) CanUpdate(data jsonutils.JSONObject) bool

func (*SImage) CustomizeCreate

func (self *SImage) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SImage) CustomizeDelete

func (self *SImage) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SImage) CustomizedGetDetailsBody

func (self *SImage) CustomizedGetDetailsBody(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SImage) Delete

func (self *SImage) Delete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SImage) DoCancelPendingDelete

func (self *SImage) DoCancelPendingDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SImage) DoCheckStatus

func (self *SImage) DoCheckStatus(ctx context.Context, userCred mcclient.TokenCredential, useFast bool)

func (*SImage) DoPendingDelete

func (self *SImage) DoPendingDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SImage) GetDetailsSubformats

func (self *SImage) GetDetailsSubformats(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SImage) GetExtraDetailsHeaders

func (self *SImage) GetExtraDetailsHeaders(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) map[string]string

func (*SImage) GetImageType

func (self *SImage) GetImageType() api.TImageType

func (*SImage) GetLocalLocation

func (self *SImage) GetLocalLocation() string

func (*SImage) GetLocalPath

func (self *SImage) GetLocalPath(format string) string

func (*SImage) GetNewLocation

func (self *SImage) GetNewLocation(newLocalPath string) string

func (*SImage) GetPath

func (self *SImage) GetPath(format string) string

func (*SImage) GetPrefix

func (self *SImage) GetPrefix() string

func (*SImage) GetQuotaKeys

func (img *SImage) GetQuotaKeys() quotas.IQuotaKeys

func (*SImage) GetUsages

func (img *SImage) GetUsages() []db.IUsage

func (*SImage) IsIso

func (self *SImage) IsIso() bool

func (*SImage) OnJointFailed

func (self *SImage) OnJointFailed(ctx context.Context, userCred mcclient.TokenCredential)

func (*SImage) OnSaveFailed

func (self *SImage) OnSaveFailed(ctx context.Context, userCred mcclient.TokenCredential, msg jsonutils.JSONObject)

func (*SImage) OnSaveSuccess

func (self *SImage) OnSaveSuccess(ctx context.Context, userCred mcclient.TokenCredential, msg string)

func (*SImage) OnSaveTaskFailed

func (self *SImage) OnSaveTaskFailed(task taskman.ITask, userCred mcclient.TokenCredential, msg jsonutils.JSONObject)

func (*SImage) OnSaveTaskSuccess

func (self *SImage) OnSaveTaskSuccess(task taskman.ITask, userCred mcclient.TokenCredential, msg string)

func (*SImage) PerformCancelDelete

func (self *SImage) PerformCancelDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SImage) PerformMarkStandard

func (self *SImage) PerformMarkStandard(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	data jsonutils.JSONObject,
) (jsonutils.JSONObject, error)

func (*SImage) PerformPrivate

func (*SImage) PerformProbe

func (*SImage) PerformPublic

func (*SImage) PerformSetClassMetadata

func (img *SImage) PerformSetClassMetadata(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input apis.PerformSetClassMetadataInput) (jsonutils.JSONObject, error)

func (*SImage) PerformUpdateStatus

func (img *SImage) PerformUpdateStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ImageUpdateStatusInput) (jsonutils.JSONObject, error)

func (*SImage) PerformUpdateTorrentStatus

func (self *SImage) PerformUpdateTorrentStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SImage) Pipeline

func (img *SImage) Pipeline(ctx context.Context, userCred mcclient.TokenCredential, skipProbe bool) error

func (*SImage) PostCreate

func (self *SImage) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SImage) PostUpdate

func (self *SImage) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SImage) PreUpdate

func (self *SImage) PreUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SImage) RealDelete

func (self *SImage) RealDelete(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SImage) Remove

func (self *SImage) Remove(ctx context.Context, userCred mcclient.TokenCredential) error

func (*SImage) RemoveFile

func (self *SImage) RemoveFile() error

func (*SImage) SaveImageFromStream

func (self *SImage) SaveImageFromStream(reader io.Reader, totalSize int64, calChecksum bool) error

Image always do probe and customize after save from stream

func (*SImage) StartImageCheckTask

func (self *SImage) StartImageCheckTask(ctx context.Context, userCred mcclient.TokenCredential, parentTaskId string) error

func (*SImage) StartImagePipeline

func (self *SImage) StartImagePipeline(
	ctx context.Context, userCred mcclient.TokenCredential, skipProbe bool,
) error

After image probe and customization, image size and checksum changed will recalculate checksum in the end

func (*SImage) StartPutImageTask

func (self *SImage) StartPutImageTask(ctx context.Context, userCred mcclient.TokenCredential, parentTaskId string) error

func (*SImage) StopTorrents

func (self *SImage) StopTorrents()

func (*SImage) ValidateDeleteCondition

func (img *SImage) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error

func (*SImage) ValidateUpdateData

func (self *SImage) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

type SImageManager

var ImageManager *SImageManager

func (*SImageManager) CleanPendingDeleteImages

func (manager *SImageManager) CleanPendingDeleteImages(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)

func (*SImageManager) CustomizeHandlerInfo

func (manager *SImageManager) CustomizeHandlerInfo(info *appsrv.SHandlerInfo)

func (*SImageManager) FetchCreateHeaderData

func (manager *SImageManager) FetchCreateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*SImageManager) FetchCustomizeColumns

func (manager *SImageManager) FetchCustomizeColumns(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	query jsonutils.JSONObject,
	objs []interface{},
	fields stringutils2.SSortedStrings,
	isList bool,
) []api.ImageDetails

func (*SImageManager) FetchUpdateHeaderData

func (manager *SImageManager) FetchUpdateHeaderData(ctx context.Context, header http.Header) (jsonutils.JSONObject, error)

func (*SImageManager) GetPropertyDetail

func (manager *SImageManager) GetPropertyDetail(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SImageManager) InitializeData

func (manager *SImageManager) InitializeData() error

func (*SImageManager) IsCustomizedGetDetailsBody

func (manager *SImageManager) IsCustomizedGetDetailsBody() bool

func (*SImageManager) ListItemFilter

func (manager *SImageManager) ListItemFilter(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query api.ImageListInput,
) (*sqlchemy.SQuery, error)

磁盘镜像列表

func (*SImageManager) OrderByExtraFields

func (manager *SImageManager) OrderByExtraFields(
	ctx context.Context,
	q *sqlchemy.SQuery,
	userCred mcclient.TokenCredential,
	query api.ImageListInput,
) (*sqlchemy.SQuery, error)

func (*SImageManager) PerformVmwareAccountAdded

func (*SImageManager) QueryDistinctExtraField

func (manager *SImageManager) QueryDistinctExtraField(q *sqlchemy.SQuery, field string) (*sqlchemy.SQuery, error)

func (*SImageManager) Usage

func (manager *SImageManager) Usage(ctx context.Context, scope rbacscope.TRbacScope, ownerId mcclient.IIdentityProvider, prefix string, policyResult rbacutils.SPolicyResult) map[string]int64

func (*SImageManager) ValidateCreateData

func (manager *SImageManager) ValidateCreateData(
	ctx context.Context,
	userCred mcclient.TokenCredential,
	ownerId mcclient.IIdentityProvider,
	query jsonutils.JSONObject,
	input api.ImageCreateInput,
) (api.ImageCreateInput, error)

type SImageMember

type SImageMember struct {
	SImagePeripheral

	Member   string `width:"255" nullable:"false"`
	CanShare bool   `nullable:"false"`
}

type SImageMemberManager

type SImageMemberManager struct {
	db.SResourceBaseManager
}

+onecloud:swagger-gen-ignore

var ImageMemberManager *SImageMemberManager

type SImagePeripheral

type SImagePeripheral struct {
	db.SResourceBase

	Id      int    `primary:"true" auto_increment:"true" nullable:"false"`
	ImageId string `width:"36" index:"true" nullable:"false"`
}

func (*SImagePeripheral) GetId

func (ip *SImagePeripheral) GetId() string

type SImageProperty

type SImageProperty struct {
	SImagePeripheral

	Name  string `width:"255"`
	Value string `nullable:"true" create:"optional"`
}

+------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | image_id | varchar(36) | NO | MUL | NULL | | | name | varchar(255) | NO | | NULL | | | value | text | YES | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | YES | | NULL | | | deleted_at | datetime | YES | | NULL | | | deleted | tinyint(1) | NO | MUL | NULL | | +------------+--------------+------+-----+---------+----------------+

func (*SImageProperty) UpdateValue

func (self *SImageProperty) UpdateValue(ctx context.Context, userCred mcclient.TokenCredential, value string) error

type SImagePropertyManager

type SImagePropertyManager struct {
	db.SResourceBaseManager
}

+onecloud:swagger-gen-ignore

var ImagePropertyManager *SImagePropertyManager

func (*SImagePropertyManager) GetProperties

func (manager *SImagePropertyManager) GetProperties(imageId string) (map[string]string, error)

func (*SImagePropertyManager) GetProperty

func (manager *SImagePropertyManager) GetProperty(imageId string, key string) (*SImageProperty, error)

func (*SImagePropertyManager) NewProperty

func (manager *SImagePropertyManager) NewProperty(ctx context.Context, userCred mcclient.TokenCredential, imageId string, key string, value string) (*SImageProperty, error)

func (*SImagePropertyManager) SaveProperties

func (manager *SImagePropertyManager) SaveProperties(ctx context.Context, userCred mcclient.TokenCredential, imageId string, props jsonutils.JSONObject) error

func (*SImagePropertyManager) SaveProperty

func (manager *SImagePropertyManager) SaveProperty(ctx context.Context, userCred mcclient.TokenCredential, imageId string, key string, value string) (*SImageProperty, error)

type SImageQuotaDetail

type SImageQuotaDetail struct {
	SQuota

	quotas.SBaseProjectQuotaDetailKeys
}

区域配额详情

func GetImageQuota

func GetImageQuota(query quotas.SBaseQuotaQueryInput) *SImageQuotaDetail

获取指定项目或者域的镜像配额

func ListImageQuotas

func ListImageQuotas(query quotas.SBaseQuotaQueryInput) *SImageQuotaDetail

获取所有项目或者域的镜像配额

func SetRegionQuotas

func SetRegionQuotas(input SetImageQuotaInput) *SImageQuotaDetail

设置指定项目或者域的镜像配额

type SImageQuotaKeys

type SImageQuotaKeys struct {
	quotas.SBaseProjectQuotaKeys

	Type string `width:"16" charset:"ascii" nullable:"false" primary:"true" list:"user"`
}

func (SImageQuotaKeys) Compare

func (k1 SImageQuotaKeys) Compare(ik quotas.IQuotaKeys) int

func (SImageQuotaKeys) Fields

func (k SImageQuotaKeys) Fields() []string

func (SImageQuotaKeys) Values

func (k SImageQuotaKeys) Values() []string

type SImageSubformat

type SImageSubformat struct {
	SImagePeripheral

	Format string `width:"20" charset:"ascii" nullable:"true"`

	Size     int64  `nullable:"true"`
	Location string `nullable:"true"`
	Checksum string `width:"32" charset:"ascii" nullable:"true"`
	FastHash string `width:"32" charset:"ascii" nullable:"true"`
	Status   string `nullable:"false"`

	TorrentSize     int64  `nullable:"true"`
	TorrentLocation string `nullable:"true"`
	TorrentChecksum string `width:"32" charset:"ascii" nullable:"true"`
	TorrentStatus   string `nullable:"false"`
}

func (*SImageSubformat) GetDetails

func (self *SImageSubformat) GetDetails() SImageSubformatDetails

func (*SImageSubformat) GetLocalLocation

func (self *SImageSubformat) GetLocalLocation() string

func (*SImageSubformat) Save

func (self *SImageSubformat) Save(image *SImage) error

func (*SImageSubformat) SaveTorrent

func (self *SImageSubformat) SaveTorrent() error

func (*SImageSubformat) SetStatus

func (self *SImageSubformat) SetStatus(status string) error

func (*SImageSubformat) SetStatusSeeding

func (self *SImageSubformat) SetStatusSeeding(seeding bool)

func (*SImageSubformat) StopTorrent

func (self *SImageSubformat) StopTorrent()

type SImageSubformatDetails

type SImageSubformatDetails struct {
	Format string

	Size     int64
	Checksum string
	FastHash string
	Status   string

	TorrentSize     int64
	TorrentChecksum string
	TorrentStatus   string

	TorrentSeeding bool
}

type SImageSubformatManager

type SImageSubformatManager struct {
	db.SResourceBaseManager
}

+onecloud:swagger-gen-ignore

var ImageSubformatManager *SImageSubformatManager

func (*SImageSubformatManager) FetchSubImage

func (manager *SImageSubformatManager) FetchSubImage(id string, format string) *SImageSubformat

func (*SImageSubformatManager) GetAllSubImages

func (manager *SImageSubformatManager) GetAllSubImages(id string) []SImageSubformat

type SImageTag

type SImageTag struct {
	SImagePeripheral

	Value string `width:"255" nullable:"false"`
}

+------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | image_id | varchar(36) | NO | MUL | NULL | | | value | varchar(255) | NO | | NULL | | | created_at | datetime | NO | | NULL | | | updated_at | datetime | YES | | NULL | | | deleted_at | datetime | YES | | NULL | | | deleted | tinyint(1) | NO | | NULL | | +------------+--------------+------+-----+---------+----------------+

type SImageTagManager

type SImageTagManager struct {
	db.SResourceBaseManager
}

+onecloud:swagger-gen-ignore

var ImageTagManager *SImageTagManager

type SImageUsage

type SImageUsage struct {
	Count int64
	Size  int64
}

type SQuota

type SQuota struct {
	quotas.SQuotaBase

	SImageQuotaKeys

	Image int `default:"-1" allow_zero:"true"`
}

func (*SQuota) Add

func (self *SQuota) Add(quota quotas.IQuota)

func (*SQuota) Allocable

func (self *SQuota) Allocable(request quotas.IQuota) int

func (*SQuota) Exceed

func (used *SQuota) Exceed(request quotas.IQuota, quota quotas.IQuota) error

func (*SQuota) FetchSystemQuota

func (self *SQuota) FetchSystemQuota()

func (*SQuota) FetchUsage

func (self *SQuota) FetchUsage(ctx context.Context) error

func (*SQuota) GetKeys

func (self *SQuota) GetKeys() quotas.IQuotaKeys

func (*SQuota) IsEmpty

func (self *SQuota) IsEmpty() bool

func (*SQuota) ResetNegative

func (self *SQuota) ResetNegative()

func (*SQuota) SetKeys

func (self *SQuota) SetKeys(keys quotas.IQuotaKeys)

func (*SQuota) Sub

func (self *SQuota) Sub(quota quotas.IQuota)

func (*SQuota) ToJSON

func (self *SQuota) ToJSON(prefix string) jsonutils.JSONObject

func (*SQuota) Update

func (self *SQuota) Update(quota quotas.IQuota)

type SQuotaManager

type SQuotaManager struct {
	quotas.SQuotaBaseManager
}

func (*SQuotaManager) FetchIdNames

func (manager *SQuotaManager) FetchIdNames(ctx context.Context, idMap map[string]map[string]string) (map[string]map[string]string, error)

type SetImageQuotaInput

type SetImageQuotaInput struct {
	quotas.SBaseQuotaSetInput

	SQuota
}

设置镜像配额输入参数

type Storage

type Storage interface {
	Type() string
	SaveImage(context.Context, string) (string, error)
	CleanTempfile(string) error
	GetImage(context.Context, string) (int64, io.ReadCloser, error)
	RemoveImage(context.Context, string) error

	IsCheckStatusEnabled() bool
	ConvertImage(ctx context.Context, image *SImage, targetFormat string) (*SConverImageInfo, error)
}

func GetStorage

func GetStorage() Storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL