models

package
v2.0.21+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiskResourceName = "disk"

	DiskInit          = "init"
	DiskRebuild       = "rebuild"
	DiskAllocFailed   = "alloc_failed"
	DiskStartAlloc    = "start_alloc"
	DiskAllocating    = "allocating"
	DiskReady         = "ready"
	DiskFrozen        = "frozen"
	DiskDealloc       = "deallocating"
	DiskDeallocFailed = "dealloc_failed"

	DiskStartSave = "start_save"
	DiskSaving    = "saving"

	DiskStartResize = "start_resize"
	DiskResizing    = "resizing"

	DiskStartMigrate = "start_migrate"
	DiskPostMigrate  = "post_migrate"
	DiskMigrating    = "migrating"

	TakeMebsSnapshot        = "take_mebs_snapshot"
	TakeMebsSnapshotFailed  = "take_mebs_snapshot_failed"
	ApplyMebsSnapshot       = "apply_mebs_snapshot"
	ApplyMebsSnapshotFailed = "apply_mebs_snapshot_failed"
	CloneMebsSnapshot       = "clone_mebs_snapshot"
	CloneMebsSnapshotFailed = "clone_mebs_snapshot_failed"
	PerformMebsBackup       = "perform_mebs_backup"
	PerformMebsBackupFailed = "perform_mebs_backup_failed"
	RestoreMebsBackup       = "restore_mebs_backup"
	RestoreMebsBackupFailed = "restore_mebs_backup_failed"
	SaveMebsTemplate        = "save_mebs_template"
	SaveMebsTemplateFailed  = "save_mebs_template_failed"

	ActionThrottle = "throttle"
	ActionFreeze   = "freeze"
	ActionUnfreeze = "unfreeze"
)
View Source
const (
	GuestResourceName = "server"

	VmInit           = "init"
	VmUnknown        = "unknown"
	VmSchedule       = "schedule"
	VmScheduleFailed = "schedule_fail"
	VmCreateNetwork  = "network"
	VmNetworkFailed  = "net_fail"
	VmCreateDisk     = "disk"
	VmDiskFailed     = "disk_fail"
	VmStartDeploy    = "start_deploy"
	VmDeploying      = "deploying"
	VmDeployFailed   = "deploy_fail"
	VmReady          = "ready"
	VmStartStart     = "start_start"
	VmStarting       = "starting"
	VmStartFailed    = "start_fail"
	VmStartRestart   = "start_restart"
	VmRunning        = "running"
	VmStartStop      = "start_stop"
	VmStopping       = "stopping"
	VmStopFailed     = "stop_fail"

	VmStartSuspend  = "start_suspend"
	VmSuspending    = "suspending"
	VmSuspend       = "suspend"
	VmSuspendFailed = "suspend_failed"

	VmReset       = "reset"
	VmStartDelete = "start_delete"
	VmDeleteFail  = "delete_fail"
	VmDeleting    = "deleting"

	VmStartMigrate  = "start_migrate"
	VmMigrating     = "migrating"
	VmMigrateFailed = "migrate_failed"

	VmDiskMigrating     = "disk_migrating"
	VmDiskMigrateFailed = "disk_migrate_fail"

	VmChangeFlavor     = "change_flavor"
	VmChangeFlavorFail = "change_flavor_fail"

	VmRebuildRoot     = "rebuild_root"
	VmRebuildRootFail = "rebuild_root_fail"

	VmRebuildDisk     = "rebuild_disk"
	VmRebuildDiskFail = "rebuild_disk_fail"

	VmBlockStream = "block_stream"

	VmStartSnapshot  = "snapshot_start"
	VmSnapshot       = "snapshot"
	VmSnapshotSucc   = "snapshot_succ"
	VmSnapshotFailed = "snapshot_failed"

	VmSyncConfig     = "sync_config"
	VmSyncConfigFail = "sync_config_failed"

	VmResizeDisk     = "resize_disk"
	VmStartSaveDisk  = "start_save_disk"
	VmSaveDisk       = "save_disk"
	VmSaveDiskFailed = "save_disk_failed"

	VmRestoringSnapshot = "restoring_snapshot"

	VmRestoreDisk   = "restore_disk"
	VmRestoreState  = "restore_state"
	VmRestoreFailed = "restore_failed"

	VmRemoveStatefile = "remove_state"

	VmHotplugCPUMEM = "hotplug_cpu_mem"

	VmAdmin = "admin"

	ShutdownStop      = "stop"
	ShutdownTerminate = "terminate"

	HostTypeHost      = "host"
	HostTypeBaremetal = "baremetal"

	GuestTypeVm        = "vm"
	GuestTypeContainer = "container"

	QGAStatusUnknown     = "unknown"
	QGAStatusStop        = "stop"
	QGAStatusStarting    = "starting"
	QGAStatusStartFailed = "start_failed"
	QGAStatusRunning     = "running"
	QGAStatusCrashed     = "crashed"
)
View Source
const (
	NetworkResourceName = "network"

	GuestNicCountC      = "GuestNiCount"
	GroupNicCountC      = "GroupNicCount"
	BaremetalNicCountC  = "BaremetalNicCount"
	ReserveDipNicCountC = "ReserveDipNicCount"
)
View Source
const (
	BaremetalNetworksResourceName = "baremetalnetworks"
)
View Source
const (
	GroupNetworksResourceName = "groupnetworks"
)
View Source
const (
	GuestNetworksResourceName = "guestnetworks"
)
View Source
const (
	HostResourceName = "host"
)
View Source
const (
	HostWireResourceName = "hostwires"
)
View Source
const (
	NetInterfaceResourceName = "netinterface"
)
View Source
const (
	NetWireResourceName = "wire"
)
View Source
const (
	ReserveDipsResourceName = "reservedips"
)

Variables

View Source
var (
	VmRunningStatus   = sets.NewString(VmStartStart, VmStarting, VmRunning, VmStopFailed, VmBlockStream)
	VmCreatingStatus  = sets.NewString(VmCreateNetwork, VmCreateDisk, VmStartDeploy, VmDeploying)
	GuestExtraFeature = sets.NewString("kvm", "storage_type")
)
View Source
var (
	HostExtraFeature = []string{"nest", "storage_type", "vip_reserved"}
)
View Source
var (
	IOThrottleActions = []string{ActionThrottle, ActionFreeze, ActionUnfreeze}
)

Functions

func All

func All(r Resourcer) ([]interface{}, error)

func AllBaremetalIDs

func AllBaremetalIDs() ([]string, error)

func AllHostIDs

func AllHostIDs() ([]string, error)

func AllIDs

func AllIDs(r Resourcer) ([]string, error)

func AllIDsWithCond

func AllIDsWithCond(r Resourcer, cond map[string]interface{}) ([]string, error)

func AllWithCond

func AllWithCond(r Resourcer, cond map[string]interface{}) ([]interface{}, error)

func AllWithDeleted

func AllWithDeleted(r Resourcer) ([]interface{}, error)

func DBValid

func DBValid() bool

func FetchBaremetalHostByIDs

func FetchBaremetalHostByIDs(ids []string) ([]interface{}, error)

func FetchByBaremetalIDs

func FetchByBaremetalIDs(r Resourcer, ids []string) ([]interface{}, error)

func FetchByGuestIDs

func FetchByGuestIDs(r Resourcer, ids []string) ([]interface{}, error)

func FetchByHostIDs

func FetchByHostIDs(r Resourcer, ids []string) ([]interface{}, error)

func FetchByID

func FetchByID(r Resourcer, id string) (interface{}, error)

func FetchByIDs

func FetchByIDs(r Resourcer, ids []string) ([]interface{}, error)

func FetchByIDsWithKey

func FetchByIDsWithKey(r Resourcer, key string, ids []string) ([]interface{}, error)

func FetchByIDsWithKeyAndCond

func FetchByIDsWithKeyAndCond(r Resourcer, key string, ids []string, cond map[string]interface{}) ([]interface{}, error)

func FetchByWireIDs

func FetchByWireIDs(r Resourcer, ids []string) ([]interface{}, error)

func FetchDiskByIDs

func FetchDiskByIDs(ids []string) ([]interface{}, error)

func FetchGroupByIDs

func FetchGroupByIDs(ids []string) ([]interface{}, error)

func FetchGuestByHostIDs

func FetchGuestByHostIDs(ids []string) ([]interface{}, error)

func FetchGuestByHostIDsWithCond

func FetchGuestByHostIDsWithCond(ids []string, cond map[string]interface{}) ([]interface{}, error)

func FetchGuestByIDs

func FetchGuestByIDs(ids []string) ([]interface{}, error)

func FetchHostByIDs

func FetchHostByIDs(ids []string) ([]interface{}, error)

func FetchHypervisorHostByIDs

func FetchHypervisorHostByIDs(ids []string) ([]interface{}, error)

func FetchMetadatas

func FetchMetadatas(resourceName string, ids, keys []string) ([]interface{}, error)

func Init

func Init(dialect string, args ...interface{}) error

func JsonString

func JsonString(obj interface{}) (string, error)

func NetworkAvaliableAddress

func NetworkAvaliableAddress(net *Network) (ports int, err error)

func NicCount

func NicCount(nicName string) (map[string]int, error)

Types

type Aggregate

type Aggregate struct {
	StandaloneModel
	DefaultStrategy string `json:"default_strategy" gorm:"not null"`
}

func HostAggregates

func HostAggregates(hostID string) ([]*Aggregate, error)

func (Aggregate) String

func (c Aggregate) String() string

func (Aggregate) TableName

func (c Aggregate) TableName() string

type AggregateHost

type AggregateHost struct {
	JointBaseModel
	HostID      string `json:"host_id" gorm:"column:host_id;not null"`
	AggregateID string `json:"schedtag_id" gorm:"column:schedtag_id;not null"`
}

func (AggregateHost) Aggregate

func (c AggregateHost) Aggregate() (*Aggregate, error)

func (AggregateHost) String

func (c AggregateHost) String() string

func (AggregateHost) TableName

func (c AggregateHost) TableName() string

type Baremetal

type Baremetal struct {
	StandaloneModel
	Status    string `json:"status" gorm:"not null"`
	Enabled   bool   `json:"enabled" gorm:"not null"`
	CliGUID   string `json:"cli_guid,omitempty"`
	AgentID   string `json:"agent_id,omitempty"`
	CPUCount  int    `json:"cpu_count,omitempty"`
	NodeCount int    `json:"node_count,omitempty"`
	CPUDesc   string `json:"cpu_desc,omitempty"`
	CPUMHZ    int    `json:"cpu_mhz,omitempty"`
	MemSize   int    `json:"mem_size,omitempty"`

	StorageSize   int    `json:"storage_size,omitempty"`
	StorageType   string `json:"storage_type,omitempty"`
	StorageDriver string `json:"storage_driver,omitempty"`
	StorageInfo   string `json:"storage_info,omitempty"`

	IpmiInfo string `json:"ipmi_info,omitempty" gorm:"type:text"`

	Rack  string `json:"rack,omitempty"`
	Slots string `json:"slots,omitempty"`

	ServerID string `json:"server_id,omitempty"`
	UseCount int    `json:"use_count,omitempty"`

	PoolID string `json:"pool_id,omitempty"`
}

func (Baremetal) String

func (b Baremetal) String() string

func (Baremetal) TableName

func (b Baremetal) TableName() string

type BaremetalAgent

type BaremetalAgent struct {
	StandaloneModel
	AccessIP   string `json:"access_ip" gorm:"not null"`
	ManagerURI string `json:"manager_uri,omitempty"`
	Status     string `json:"status" gorm:"not null"`
	ZoneID     string `json:"zone_id,omitempty"`
	Version    string `json:"version,omitempty"`
}

func (BaremetalAgent) String

func (b BaremetalAgent) String() string

func (BaremetalAgent) TableName

func (b BaremetalAgent) TableName() string

type BaremetalNetwork

type BaremetalNetwork struct {
	StandaloneModel
	BaremetalID   string `json:"baremetal_id,omitempty" gorm:"column:Baremetal_id;not null"`
	NetworkID     string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	MacAddr       string `json:"mac_addr" gorm:"column:mac_addr;not null"`
	IpAddr        string `json:"ip_addr,omitempty" gorm:"column:ip_addr"`
	Ip6Addr       string `json:"ip6_addr" gorm:"column:ip6_addr"`
	Driver        string `json:"driver" gorm:"column:driver"`
	BwLimit       int64  `json:"bw_limit" gorm:"column:bw_limit;not null"`
	Index         int    `json:"index" gorm:"column:index;not null"`
	Virtual       int    `json:"virtual" gorm:"column:virtual"`
	IfName        string `json:"if_name,omitempty" gorm:"column:if_name"`
	MappingIpAddr string `json:"mapping_ip_addr" gorm:"column:mapping_ip_addr"`
}

func (BaremetalNetwork) String

func (n BaremetalNetwork) String() string

func (BaremetalNetwork) TableName

func (n BaremetalNetwork) TableName() string

type BaremetalNicCount

type BaremetalNicCount struct {
	NetworkID string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	Count     int    `json:"count" gorm:"column:count;not null"`
}

func BaremetalNicCounts

func BaremetalNicCounts() ([]BaremetalNicCount, error)

func (BaremetalNicCount) First

func (c BaremetalNicCount) First() string

func (BaremetalNicCount) Second

func (c BaremetalNicCount) Second() int

type BaremetalNicCounti

type BaremetalNicCounti struct {
	Count int `json:"count" gorm:"column:count;not null"`
}

func BaremetalNicCountsWithNetworkID

func BaremetalNicCountsWithNetworkID(networkID string) (BaremetalNicCounti, error)

func (BaremetalNicCounti) First

func (c BaremetalNicCounti) First() int

type BaremetalWire

type BaremetalWire struct {
	BaremetalID string `json:"baremetal_id" gorm:"column:baremetal_id;not null"`
	WireID      string `json:"wire_id" gorm:"column:wire_id;not null"`
}

func SelectWiresAndBaremetals

func SelectWiresAndBaremetals() ([]BaremetalWire, error)

func SelectWiresWithBaremetalID

func SelectWiresWithBaremetalID(baremetalID string) ([]BaremetalWire, error)

func (BaremetalWire) First

func (c BaremetalWire) First() string

type BaseModel

type BaseModel struct {
	CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:datetime" sql:"DEFAULT:NULL"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:datetime" sql:"DEFAULT:NULL"`
	DeletedAt time.Time `json:"deleted_at" gorm:"column:deleted_at;type:datetime" sql:"DEFAULT:NULL"`
	Deleted   bool      `json:"deleted" gorm:"column:deleted;not null;index" sql:"DEFAULT:false"`
}

type Cluster

type Cluster struct {
	StandaloneModel
	HostIPStart  string `json:"host_ip_start" gorm:"not null"`
	HostIPEnd    string `json:"host_ip_end" gorm:"not null"`
	HostNetmask  int    `json:"host_netmask,omitempty"`
	HostGateway  string `json:"host_gateway,omitempty"`
	HostDNS      string `json:"host_dns,omitempty"`
	ScheduleRank int    `json:"schedule_rank,omitempty"`
	ZoneID       string `json:"zone_id" gorm:"not null"`
}

func (Cluster) String

func (c Cluster) String() string

func (Cluster) TableName

func (c Cluster) TableName() string

type Disk

type Disk struct {
	SharableVirtualResourceModel
	DiskFormat string `json:"disk_format" gorm:"column:disk_format;not null"`
	DiskSize   int64  `json:"disk_size" gorm:"column:disk_size;not null"`
	AccessPath string `json:"access_path" gorm:"column:access_path;not null"`
	AutoDelete bool   `json:"auto_delete" gorm:"column:auto_delete;not null"`
	StorageID  string `json:"storage_id" gorm:"column:storage_id;not null"`
	MebsInfo   string `json:"mebs_info" gorm:"column:mebs_info;type:text"`
}

func (Disk) IsLocal

func (d Disk) IsLocal() (bool, error)

func (Disk) Storage

func (d Disk) Storage() (*Storage, error)

func (Disk) String

func (d Disk) String() string

func (Disk) TableName

func (d Disk) TableName() string

type Group

type Group struct {
	VirtualResourceModel
	ServiceType   string `json:"service_type" gorm:"column:service_type"`
	ParentID      string `json:"parent_id" gorm:"column:parent_id"`
	ZoneID        string `json:"zone_id" gorm:"column:zone_id"`
	SchedStrategy string `json:"sched_strategy" gorm:"column:sched_strategy"`
}

func (Group) String

func (g Group) String() string

func (Group) TableName

func (g Group) TableName() string

type GroupGuest

type GroupGuest struct {
	GroupJointModel
	Tag     *string `json:"tag" gorm:"column:tag"`
	GuestID *string `json:"guest_id" gorm:"column:guest_id"`
}

func (GroupGuest) String

func (g GroupGuest) String() string

func (GroupGuest) TableName

func (g GroupGuest) TableName() string

type GroupJointModel

type GroupJointModel struct {
	JointBaseModel
	GroupID string `json:"group_id" gorm:"not null"`
}

type GroupNetwork

type GroupNetwork struct {
	StandaloneModel
	GroupID       string `json:"group_id,omitempty" gorm:"column:group_id;not null"`
	NetworkID     string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	IpAddr        string `json:"ip_addr,omitempty" gorm:"column:ip_addr"`
	Index         int    `json:"index" gorm:"column:index;not null"`
	EipID         string `json:"eip_id,omitempty" gorm:"column:if_name"`
	MappingIpAddr string `json:"mapping_ip_addr" gorm:"column:mapping_ip_addr"`
}

func (GroupNetwork) String

func (n GroupNetwork) String() string

func (GroupNetwork) TableName

func (n GroupNetwork) TableName() string

type GroupNicCount

type GroupNicCount struct {
	NetworkID string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	Count     int    `json:"count" gorm:"column:count;not null"`
}

func GroupNicCounts

func GroupNicCounts() ([]GroupNicCount, error)

func (GroupNicCount) First

func (c GroupNicCount) First() string

func (GroupNicCount) Second

func (c GroupNicCount) Second() int

type GroupNicCounti

type GroupNicCounti struct {
	Count int `json:"count" gorm:"column:count;not null"`
}

func GroupNicCountsWithNetworkID

func GroupNicCountsWithNetworkID(networkID string) (GroupNicCounti, error)

func (GroupNicCounti) First

func (c GroupNicCounti) First() int

type Guest

type Guest struct {
	VirtualResourceModel
	VCPUCount        int64  `json:"vcpu_count" gorm:"column:vcpu_count;type:tinyint64(4);not null"`
	VMemSize         int64  `json:"vmem_size" gorm:"column:vmem_size;type:int64(11);not null"`
	DimmSlots        string `json:"dimm_slots,omitempty" gorm:"column:dimm_slots;type:text"`
	BootOrder        string `json:"boot_order,omitempty" gorm:"column:boot_order"`
	DisableDelete    bool   `json:"disable_delete" gorm:"column:disable_delete"`
	ShutdownBehavior string `json:"shutdown_behavior,omitempty" gorm:"column:shutdown_behavior"`
	KeypairID        string `json:"keypair_id,omitempty" gorm:"column:keypair_id"`
	HostID           string `json:"host_id,omitempty" gorm:"column:host_id"`
	VNCPort          int64  `json:"vnc_port,omitempty" gorm:"column:vnc_port"`
	VGA              string `json:"vga" gorm:"column:vga"`
	FlavorID         string `json:"flavor_id,omitempty" gorm:"column:flavor_id"`
	SecgrpID         string `json:"secgrp_id,omitempty" gorm:"column:secgrp_id"`
	AdminSecgrpID    string `json:"admin_secgrp_id,omitempty" gorm:"column:admin_secgrp_id"`
	VrouterID        string `json:"vrouter_id,omitempty" gorm:"column:vrouter_id"`
	HostType         string `json:"host_type,omitempty" gorm:"column:host_type"`
	PreferZoneID     string `json:"prefer_zone_id,omitempty" gorm:"column:prefer_zone_id"`
	GuestType        string `json:"guest_type,omitempty" gorm:"column:guest_type"`
	QGAStatus        string `json:"qga_status" gorm:"column:qga_status"`
}

func (Guest) DiskSize

func (g Guest) DiskSize(onlyLocal bool) (int64, error)

func (Guest) Disks

func (g Guest) Disks(diskFormat ...string) *gorm.DB

func (Guest) DisksQuery

func (g Guest) DisksQuery(diskFormat ...string) *gorm.DB

func (Guest) IsCreating

func (g Guest) IsCreating() bool

func (Guest) IsGuestFakeDeleted

func (g Guest) IsGuestFakeDeleted() bool

func (Guest) IsRunning

func (g Guest) IsRunning() bool

func (Guest) String

func (g Guest) String() string

func (Guest) TableName

func (g Guest) TableName() string

type GuestDisk

type GuestDisk struct {
	GuestJointModel
	DiskID    string `json:"disk_id" gorm:"column:disk_id;not null;index"`
	ImagePath string `json:"image_path" gorm:"column:image_path;not null"`
	Driver    string `json:"driver" gorm:"column:driver"`
	CacheMode string `json:"cache_mode" gorm:"column:cache_mode"`
	AioMode   string `json:"aio_mode" gorm:"column:aio_mode"`
	Index     int    `json:"index" gorm:"column:index;not null"`
}

func (GuestDisk) Disk

func (d GuestDisk) Disk() (*Disk, error)

func (GuestDisk) String

func (d GuestDisk) String() string

func (GuestDisk) TableName

func (d GuestDisk) TableName() string

type GuestJointModel

type GuestJointModel struct {
	JointBaseModel
	GuestID string `json:"guest_id" gorm:"column:guest_id;not null;index"`
}

type GuestNetwork

type GuestNetwork struct {
	StandaloneModel
	GuestID       string `json:"guest_id,omitempty" gorm:"column:guest_id;not null"`
	NetworkID     string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	MacAddr       string `json:"mac_addr" gorm:"column:mac_addr;not null"`
	IpAddr        string `json:"ip_addr,omitempty" gorm:"column:ip_addr"`
	Ip6Addr       string `json:"ip6_addr" gorm:"column:ip6_addr"`
	Driver        string `json:"driver" gorm:"column:driver"`
	BwLimit       int64  `json:"bw_limit" gorm:"column:bw_limit;not null"`
	Index         int    `json:"index" gorm:"column:index;not null"`
	Virtual       int    `json:"virtual" gorm:"column:virtual"`
	IfName        string `json:"if_name,omitempty" gorm:"column:if_name"`
	MappingIpAddr string `json:"mapping_ip_addr" gorm:"column:mapping_ip_addr"`
}

func (GuestNetwork) String

func (n GuestNetwork) String() string

func (GuestNetwork) TableName

func (n GuestNetwork) TableName() string

type GuestNicCount

type GuestNicCount struct {
	NetworkID string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	Count     int    `json:"count" gorm:"column:count;not null"`
}

func GuestNicCounts

func GuestNicCounts() ([]GuestNicCount, error)

func (GuestNicCount) First

func (c GuestNicCount) First() string

func (GuestNicCount) Second

func (c GuestNicCount) Second() int

type GuestNicCounti

type GuestNicCounti struct {
	Count int `json:"count" gorm:"column:count;not null"`
}

func GuestNicCountsWithNetworkID

func GuestNicCountsWithNetworkID(networkID string) (GuestNicCounti, error)

func (GuestNicCounti) First

func (c GuestNicCounti) First() int

type Host

type Host struct {
	StandaloneModel

	Rack       string `json:"rack,omitempty" gorm:"column:rack"`
	Slots      string `json:"slots,omitempty" gorm:"column:slots"`
	AccessMAC  string `json:"access_mac" gorm:"not null"`
	AccessIP   string `json:"access_ip" gorm:"column:access_ip"`
	ManagerURI string `json:"manager_uri,omitempty" gorm:"column:manager_uri"`
	SysInfo    string `json:"sys_info,omitempty" gorm:"type:text"`
	Sn         string `json:"sn,omitempty" gorm:"column:sn"`

	CPUCount    int64    `json:"cpu_count" gorm:"column:cpu_count"`
	NodeCount   int64    `json:"node_count" gorm:"column:node_count"`
	CPUDesc     string   `json:"cpu_desc" gorm:"column:cpu_desc"`
	CPUMHZ      int64    `json:"cpu_mhz" gorm:"column:cpu_mhz"`
	CPUCache    int64    `json:"cpu_cache" gorm:"column:cpu_cache"`
	CPUReserved int64    `json:"cpu_reserved" gorm:"column:cpu_reserved"`
	CPUCmtbound *float64 `json:"cpu_cmtbound" gorm:"column:cpu_cmtbound"`

	MemSize     int64    `json:"mem_size" gorm:"column:mem_size"`
	MemReserved int64    `json:"mem_reserved" gorm:"column:mem_reserved"`
	MemCmtbound *float64 `json:"mem_cmtbound" gorm:"column:mem_cmtbound"`

	StorageSize   int    `json:"storage_size,omitempty" gorm:"column:storage_size"`
	StorageType   string `json:"storage_type,omitempty" gorm:"column:storage_type"`
	StorageDriver string `json:"storage_driver,omitempty" gorm:"column:storage_driver"`
	StorageInfo   string `json:"storage_info,omitempty" gorm:"column:storage_info"`
	IpmiInfo      string `json:"ipmi_info,omitempty" gorm:"type:text"`

	Status        string  `json:"status" gorm:"column:status;not null"`
	HostStatus    string  `json:"host_status" gorm:"column:host_status;not null"`
	Enabled       bool    `json:"enabled" gorm:"column:enabled;not null"`
	ZoneID        string  `json:"zone_id" gorm:"column:zone_id;not null"`
	HostType      string  `json:"host_type" gorm:"column:host_type"`
	Version       string  `json:"version" gorm:"column:version"`
	IsBaremetal   bool    `json:"is_baremetal" gorm:"column:is_baremetal"`
	ManagerID     *string `json:"manager_id" gorm:"column:manager_id"`
	IsMaintenance bool    `json:"is_maintenance" gorm:"column:is_maintenance"`

	// DECAPITATE
	ClusterID string `json:"cluster_id" gorm:"column:cluster_id"`
	PoolID    string `json:"pool_id,omitempty" gorm:"column:pool_id"`
}

func (Host) CPUOverCommitBound

func (h Host) CPUOverCommitBound() float64

func (Host) IsHypervisor

func (h Host) IsHypervisor() bool

func (Host) MemOverCommitBound

func (h Host) MemOverCommitBound() float64

func (Host) String

func (h Host) String() string

func (Host) TableName

func (h Host) TableName() string

type Host2Wire

type Host2Wire struct {
	HostID string `json:"host_id" gorm:"column:host_id;not null"`
	WireID string `json:"wire_id" gorm:"column:wire_id;not null"`
}

func SelectHostHasWires

func SelectHostHasWires() ([]Host2Wire, error)

func SelectWiresWithHostID

func SelectWiresWithHostID(hostID string) ([]Host2Wire, error)

func (Host2Wire) First

func (c Host2Wire) First() string

type HostJointModel

type HostJointModel struct {
	JointBaseModel
	HostID string `json:"host_id" gorm:"not null"`
}

type HostStorage

type HostStorage struct {
	HostJointModel
	MountPoint string `json:"mount_point" gorm:"not null"`
	StorageID  string `json:"storage_id" gorm:"not null"`
}

func (HostStorage) String

func (s HostStorage) String() string

func (HostStorage) TableName

func (s HostStorage) TableName() string

type HostWire

type HostWire struct {
	StandaloneModel
	Bridge    string `json:"bridge,omitempty" gorm:"not null"`
	Interface string `json:"interface,omitempty" gorm:"not null"`
	HostID    string `json:"host_id,omitempty" gorm:"not null"`
	WireID    string `json:"wire_id,omitempty" gorm:"not null"`
}

func (HostWire) String

func (w HostWire) String() string

func (HostWire) TableName

func (w HostWire) TableName() string

type IsolatedDevice

type IsolatedDevice struct {
	StandaloneModel
	HostID         string `json:"host_id,omitempty" gorm:"column:host_id;not null"`
	DevType        string `json:"dev_type" gorm:"column:dev_type;not null"`
	Model          string `json:"model" gorm:"column:model;not null"`
	GuestID        string `json:"guest_id" gorm:"column:guest_id"`
	Addr           string `json:"addr" gorm:"column:addr"`
	VendorDeviceID string `json:"vendor_device_id" gorm:"column:vendor_device_id"`
}

func (IsolatedDevice) String

func (d IsolatedDevice) String() string

func (IsolatedDevice) TableName

func (d IsolatedDevice) TableName() string

type JointBaseModel

type JointBaseModel struct {
	BaseModel
	RowID string `json:"row_id" gorm:"primary_key;column:row_id"`
}

func (*JointBaseModel) UUID

func (m *JointBaseModel) UUID() string

type Metadata

type Metadata struct {
	ID        string    `json:"id" gorm:"primary_key;column:id;type:varchar(128) CHARACTER SET ascii"`
	Key       string    `json:"key" gorm:"primary_key;column:key;type:varchar(64) CHARACTER SET ascii"`
	Value     string    `json:"value" gorm:"type:text CHARACTER SET utf8"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:datetime" sql:"DEFAULT:NULL"`
}

func (Metadata) String

func (m Metadata) String() string

func (Metadata) TableName

func (m Metadata) TableName() string

type Modeler

type Modeler interface {
	UUID() string
}

type NetInterface

type NetInterface struct {
	Mac         string `json:"mac,omitempty" gorm:"not null"`
	BaremetalId string `json:"baremetal_id,omitempty"`
	WireId      string `json:"wire_id,omitempty"`
	Rate        int64  `json:"rate,omitempty"`
	NicType     string `json:"nic_type,omitempty"`
	Index       int    `json:"index,omitempty"`
	LinkUp      int    `json:"link_up,omitempty"`
	Mtu         int64  `json:"mtu,omitempty"`
}

func (NetInterface) String

func (n NetInterface) String() string

func (NetInterface) TableName

func (n NetInterface) TableName() string

type Network

type Network struct {
	StandaloneModel
	Status        string `json:"status,omitempty" gorm:"not null"`
	TenantID      string `json:"tenant_id,omitempty" gorm:"not null"`
	UserId        string `json:"user_id,omitempty" gorm:"not null"`
	IsPublic      int    `json:"is_public,omitempty" gorm:"not null"`
	GuestIpStart  string `json:"guest_ip_start,omitempty" gorm:"not null"`
	GuestIpEnd    string `json:"guest_ip_end,omitempty" gorm:"not null"`
	GuestIpMask   int    `json:"guest_ip_mask,omitempty" gorm:"not null"`
	GuestGateway  string `json:"guest_gateway,omitempty"`
	GuestDns      string `json:"guest_dns,omitempty"`
	GuestIp6Start string `json:"guest_ip6_start,omitempty"`
	GuestIp6End   string `json:"guest_ip6_end,omitempty"`
	GuestIp6Mask  int    `json:"guest_ip6_mask,omitempty"`
	GuestGateway6 string `json:"guest_gateway6,omitempty"`
	GuestDns6     string `json:"guest_dns6,omitempty"`
	GuestDomain6  string `json:"guest_domain6,omitempty"`
	VlanId        int64  `json:"vlan_id,omitempty" gorm:"not null"`
	DhcpHostId    string `json:"dhcp_host_id,omitempty"`
	WireID        string `json:"wire_id,omitempty"`
	IsChanged     int    `json:"is_changed,omitempty" gorm:"not null"`
	IsSystem      int    `json:"is_system,omitempty"`
	GuestDhcp     string `json:"guest_dhcp,omitempty"`
	BillingType   string `json:"billing_type,omitempty"`
	ServerType    string `json:"server_type,omitempty"`
	VpcId         string `json:"vpc_id,omitempty"`
	ZoneId        string `json:"zone_id,omitempty"`
	AcSubnetId    string `json:"ac_subnet_id,omitempty"`
}

func (Network) String

func (n Network) String() string

func (Network) TableName

func (n Network) TableName() string

type NetworkSchedResult

type NetworkSchedResult struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	TenantID   string `json:"tenant_id"`
	IsPublic   bool   `json:"is_public"`
	ServerType string `json:"server_type"`
	Ports      int    `json:"ports"`
	IsExit     bool   `json:"is_exit"`
	Wire       string `json:"wire_name"`
	WireID     string `json:"wire_id"`
}

func HostNetworkSchedResults

func HostNetworkSchedResults(hostID string) ([]*NetworkSchedResult, error)

func NewNetworkSchedResult

func NewNetworkSchedResult(net *Network) (*NetworkSchedResult, error)

type ReserveDipNetwork

type ReserveDipNetwork struct {
	StandaloneModel
	NetworkID string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	IpAddr    string `json:"ip_addr,omitempty" gorm:"column:ip_addr"`
	Notes     string `json:"notes" gorm:"column:notes"`
}

func (ReserveDipNetwork) String

func (n ReserveDipNetwork) String() string

func (ReserveDipNetwork) TableName

func (n ReserveDipNetwork) TableName() string

type ReserveNicCount

type ReserveNicCount struct {
	NetworkID string `json:"network_id,omitempty" gorm:"column:network_id;not null"`
	Count     int    `json:"count" gorm:"column:count;not null"`
}

func ReserveNicCounts

func ReserveNicCounts() ([]ReserveNicCount, error)

func (ReserveNicCount) First

func (c ReserveNicCount) First() string

func (ReserveNicCount) Second

func (c ReserveNicCount) Second() int

type ReserveNicCounti

type ReserveNicCounti struct {
	Count int `json:"count" gorm:"column:count;not null"`
}

func ReserveNicCountsWithNetworkID

func ReserveNicCountsWithNetworkID(networkID string) (ReserveNicCounti, error)

func (ReserveNicCounti) First

func (c ReserveNicCounti) First() int

type ResidentTenant

type ResidentTenant struct {
	HostID      string `json:"host_id" gorm:"column:host_id;not null"`
	TenantID    string `json:"tenant_id" gorm:"column:tenant_id;not null"`
	TenantCount int64  `json:"tenant_count" gorm:"column:tenant_count"`
}

func ResidentTenantsInHosts

func ResidentTenantsInHosts(hostIDs []string) ([]ResidentTenant, error)

func (ResidentTenant) First

func (t ResidentTenant) First() string

func (ResidentTenant) Second

func (t ResidentTenant) Second() string

func (ResidentTenant) Third

func (t ResidentTenant) Third() interface{}

type Resourcer

type Resourcer interface {
	DB() *gorm.DB
	TableName() string
	Model() interface{}
	Models() interface{}
}
var (
	Hosts     Resourcer
	HostWires Resourcer

	Clusters Resourcer
	Guests   Resourcer

	Baremetals        Resourcer
	BaremetalAgents   Resourcer
	BaremetalNetworks Resourcer

	Storages     Resourcer
	HostStorages Resourcer

	GroupGuests   Resourcer
	Groups        Resourcer
	GroupNetworks Resourcer

	Metadatas Resourcer

	IsolatedDevices Resourcer
	Disks           Resourcer

	GuestDisks    Resourcer
	GuestNetworks Resourcer

	Aggregates     Resourcer
	AggregateHosts Resourcer

	Networks      Resourcer
	NetInterfaces Resourcer

	Wires Resourcer

	ReserveDipsNerworks Resourcer
)

func NewAggregateHostResource

func NewAggregateHostResource(db *gorm.DB) (Resourcer, error)

func NewAggregateResource

func NewAggregateResource(db *gorm.DB) (Resourcer, error)

func NewBaremetalAgentResource

func NewBaremetalAgentResource(db *gorm.DB) (Resourcer, error)

func NewBaremetalNetworksResource

func NewBaremetalNetworksResource(db *gorm.DB) (Resourcer, error)

func NewBaremetalResource

func NewBaremetalResource(db *gorm.DB) (Resourcer, error)

func NewClusterResource

func NewClusterResource(db *gorm.DB) (Resourcer, error)

func NewDiskResource

func NewDiskResource(db *gorm.DB) (Resourcer, error)

func NewGroupGuestResource

func NewGroupGuestResource(db *gorm.DB) (Resourcer, error)

func NewGroupNetworksResource

func NewGroupNetworksResource(db *gorm.DB) (Resourcer, error)

func NewGroupResource

func NewGroupResource(db *gorm.DB) (Resourcer, error)

func NewGuestDiskResource

func NewGuestDiskResource(db *gorm.DB) (Resourcer, error)

func NewGuestNetworksResource

func NewGuestNetworksResource(db *gorm.DB) (Resourcer, error)

func NewGuestResource

func NewGuestResource(db *gorm.DB) (Resourcer, error)

func NewHostResource

func NewHostResource(db *gorm.DB) (Resourcer, error)

func NewHostStorageResource

func NewHostStorageResource(db *gorm.DB) (Resourcer, error)

func NewHostWiresResource

func NewHostWiresResource(db *gorm.DB) (Resourcer, error)

func NewIsolatedDeviceResource

func NewIsolatedDeviceResource(db *gorm.DB) (Resourcer, error)

func NewMetadataResource

func NewMetadataResource(db *gorm.DB) (Resourcer, error)

func NewNetInterfacesResource

func NewNetInterfacesResource(db *gorm.DB) (Resourcer, error)

func NewNetworksResource

func NewNetworksResource(db *gorm.DB) (Resourcer, error)

func NewReserveDipsNetworksResource

func NewReserveDipsNetworksResource(db *gorm.DB) (Resourcer, error)

func NewStorageResource

func NewStorageResource(db *gorm.DB) (Resourcer, error)

func NewWiresResource

func NewWiresResource(db *gorm.DB) (Resourcer, error)

type SharableVirtualResourceModel

type SharableVirtualResourceModel struct {
	VirtualResourceModel
	IsPublic bool `json:"is_public" gorm:"column:is_public;not null"`
}

type StandaloneModel

type StandaloneModel struct {
	BaseModel
	ID          string `json:"id" gorm:"primary_key;column:id;type:varchar(36) CHARACTER SET ascii"`
	Name        string `json:"name" gorm:"column:name;type:varchar(128) CHARACTER SET utf8"`
	Description string `json:"description,omitempty" gorm:"column:description"`
}

func (*StandaloneModel) UUID

func (m *StandaloneModel) UUID() string

type StatusOfHost

type StatusOfHost struct {
	ID        string    `json:"id" gorm:"primary_key;column:id;type:varchar(36) CHARACTER SET ascii"`
	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:datetime" sql:"DEFAULT:NULL"`
}

func AllHostStatus

func AllHostStatus(isBaremetal bool) ([]StatusOfHost, error)

type Storage

type Storage struct {
	StandaloneModel
	Capacity    int64    `json:"capacity" gorm:"not null"`
	StorageType string   `json:"storage_type" gorm:"not null"`
	MediumType  string   `json:"medium_type" gorm:"not null"`
	Cmtbound    *float64 `json:"cmtbound"`
	Status      string   `json:"status" gorm:"not null"`
	StorageConf string   `json:"storage_conf" gorm:"type:text"`
	ZoneID      string   `json:"zone_id"`
}

func (Storage) OverCommitBound

func (s Storage) OverCommitBound() float64

func (Storage) String

func (s Storage) String() string

func (Storage) TableName

func (s Storage) TableName() string

type StorageCapacity

type StorageCapacity struct {
	StorageID string `json:"storage_id" gorm:"column:storage_id;not null"`
	Status    string `json:"status" gorm:"not null"`
	TotalSize int64  `json:"total_size" gorm:"column:total_size"`
}

func GetStorageCapacities

func GetStorageCapacities(storageIDs []string) ([]StorageCapacity, error)

func (StorageCapacity) First

func (s StorageCapacity) First() string

func (StorageCapacity) Second

func (s StorageCapacity) Second() string

func (StorageCapacity) Third

func (s StorageCapacity) Third() interface{}

type VirtualResourceModel

type VirtualResourceModel struct {
	StandaloneModel
	Status           string    `json:"status" gorm:"column:status;not null"`
	TenantID         string    `json:"tenant_id" gorm:"column:tenant_id;not null"`
	UserID           string    `json:"user_id" gorm:"column:user_id;not null"`
	BillingType      string    `json:"billing_type" gorm:"column:billing_type"`
	IsSystem         bool      `json:"is_system" gorm:"column:is_system"`
	PendingDeletedAt time.Time `json:"pending_deleted_at" gorm:"column:pending_deleted_at;type:datetime" sql:"DEFAULT:NULL"`
	PendingDeleted   bool      `json:"pending_deleted" gorm:"column:pending_deleted;not null;index" sql:"DEFAULT:false"`
}

type Wire

type Wire struct {
	StandaloneModel
	Bandwidth  int64  `json:"bandwidth,omitempty" gorm:"not null"`
	NetDns     string `json:"net_dns,omitempty"`
	NetDomain  string `json:"net_domain,omitempty"`
	VpcVersion int64  `json:"vpc_version,omitempty" gorm:"not null"`
}

func (Wire) String

func (w Wire) String() string

func (Wire) TableName

func (w Wire) TableName() string

type WireInfo

type WireInfo struct {
	ID   string `json:"id" gorm:"column:id;not null"`
	Name string `json:"name" gorm:"column:name;not null"`
}

func LoadAllWires

func LoadAllWires() ([]WireInfo, error)

func (WireInfo) First

func (i WireInfo) First() string

func (WireInfo) Second

func (i WireInfo) Second() string

type WireNetwork

type WireNetwork struct {
	ID           string `json:"id,omitempty" gorm:"not null"`
	TenantID     string `json:"tenant_id,omitempty" gorm:"not null"`
	GuestIpStart string `json:"guest_ip_start,omitempty" gorm:"not null"`
	GuestIpEnd   string `json:"guest_ip_end,omitempty" gorm:"not null"`
	IsPublic     int    `json:"is_public,omitempty" gorm:"not null"`
	WireID       string `json:"wire_id,omitempty"`
	ServerType   string `json:"server_type,omitempty"`
}

func SelectNetworksWithByWireIDs

func SelectNetworksWithByWireIDs(wireIDs []string) ([]WireNetwork, error)

func SelectNetworksWithByWireIDsi

func SelectNetworksWithByWireIDsi(wireIDs []string) ([]WireNetwork, error)

func SelectWireIDsHasNetworks

func SelectWireIDsHasNetworks() ([]WireNetwork, error)

func (WireNetwork) First

func (c WireNetwork) First() string

Jump to

Keyboard shortcuts

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