| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- // Copyright 2019 Yunion
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- package desc
- import (
- "yunion.io/x/jsonutils"
- api "yunion.io/x/onecloud/pkg/apis/compute"
- "yunion.io/x/onecloud/pkg/apis/host"
- )
- type SGuestCpu struct {
- Cpus uint
- Sockets uint
- Cores uint
- Threads uint
- MaxCpus uint
- Model string
- Vendor string
- Level string
- Features map[string]bool `json:",omitempty"`
- Accel string
- // emulate, passthrough, disable
- // CpuCacheMode string
- }
- type SCpuPin struct {
- Vcpus string
- Pcpus string
- }
- type SMemDevice struct {
- Type string
- Id string
- }
- type SMemSlot struct {
- SizeMB int64
- MemObj *SMemDesc
- MemDev *SMemDevice
- }
- type SCpuNumaPin struct {
- SizeMB int64
- Unregular bool
- NodeId *uint16 `json:",omitempty"`
- VcpuPin []SVCpuPin `json:",omitempty"`
- ExtraCpuCount int `json:"extra_cpu_count"`
- }
- type SVCpuPin struct {
- Vcpu int
- Pcpu int
- }
- type SMemDesc struct {
- *Object
- NodeId *uint16 `json:",omitempty"`
- // vcpus
- Cpus *string `json:",omitempty"`
- }
- type SMemsDesc struct {
- SMemDesc
- Mems []SMemDesc `json:",omitempty"`
- }
- type SGuestMem struct {
- Slots uint
- MaxMem uint
- SizeMB int64
- Mem *SMemsDesc `json:",omitempty"`
- // hotplug mem devices
- MemSlots []*SMemSlot `json:",omitempty"`
- }
- type SGuestHardwareDesc struct {
- Cpu int64
- CpuDesc *SGuestCpu `json:",omitempty"`
- VcpuPin []SCpuPin `json:",omitempty"`
- // Clock *SGuestClock `json:",omitempty"`
- // memory size in MB
- Mem int64
- MemDesc *SGuestMem `json:",omitempty"`
- CpuNumaPin []*SCpuNumaPin `json:",omitempty"`
- Bios string
- BootOrder string
- // supported machine type: pc, q35, virt
- Machine string
- MachineDesc *SGuestMachine `json:",omitempty"`
- NoHpet *bool `json:",omitempty"` // i386 target only
- VirtioSerial *SGuestVirtioSerial
- Tpm *SGuestTpm
- // std virtio cirrus vmware qlx none
- Vga string
- VgaDevice *SGuestVga `json:",omitempty"`
- // vnc or spice
- Vdi string
- VdiDevice *SGuestVdi `json:",omitempty"`
- VirtioScsi *SGuestVirtioScsi `json:",omitempty"`
- PvScsi *SGuestPvScsi `json:",omitempty"`
- SataController *SGuestAhciDevice `json:",omitempty"`
- Cdroms []*SGuestCdrom `json:"cdroms,omitempty"`
- Floppys []*SGuestFloppy `json:",omitempty"`
- Disks []*SGuestDisk `json:",omitempty"`
- Nics []*SGuestNetwork `json:",omitempty"`
- IsolatedDevices []*SGuestIsolatedDevice `json:",omitempty"`
- // Random Number Generator Device
- Rng *SGuestRng `json:",omitempty"`
- Qga *SGuestQga `json:",omitempty"`
- Pvpanic *SGuestPvpanic `json:",omitempty"`
- IsaSerial *SGuestIsaSerial `json:",omitempty"`
- Usb *UsbController `json:",omitempty"`
- PCIControllers []*PCIController `json:",omitempty"`
- AnonymousPCIDevs []*PCIDevice `json:",omitempty"`
- RescueInitdPath string `json:",omitempty"` // rescue initramfs path
- RescueKernelPath string `json:",omitempty"` // rescue kernel path
- RescueDiskPath string `json:",omitempty"` // rescue disk path
- RescueDiskDeviceBus uint `json:",omitempty"` // rescue disk device bus
- RescueDiskDeviceSlot uint `json:",omitempty"` // rescue disk device slot
- }
- type SGuestIsaSerial struct {
- Pty *CharDev
- Id string
- }
- type SGuestQga struct {
- Socket *CharDev
- SerialPort *VirtSerialPort
- }
- type VirtSerialPort struct {
- Chardev string
- Name string
- Options map[string]string `json:",omitempty"`
- }
- type SGuestPvpanic struct {
- Ioport uint // default ioport 1285(0x505)
- Id string
- }
- type SGuestTpm struct {
- TpmSock *CharDev
- // default emulator tpm
- Id string
- }
- // -device pcie-pci-bridge,id=pci.1,bus=pcie.0 \
- // -device pci-bridge,id=pci.2,bus=pci.1,chassis_nr=1,addr=0x01 \
- type PCIController struct {
- *PCIDevice
- CType PCI_CONTROLLER_TYPE
- }
- type SGuestMachine struct {
- Accel string
- // arm only
- GicVersion *string `json:",omitempty"`
- }
- type SGuestDisk struct {
- api.GuestdiskJsonDesc
- // disk driver virtio
- Pci *PCIDevice `json:",omitempty"`
- // disk driver scsi/pvscsi
- Scsi *SCSIDevice `json:",omitempty"`
- // disk driver ide/sata
- Ide *IDEDevice `json:",omitempty"`
- }
- // -device ide-cd,drive=ide0-cd0,bus=ide.1
- // -drive id=ide0-cd0,media=cdrom,if=none,file=%s
- // --- mac os
- // -device ide-drive,drive=MacDVD,bus=ide.%d
- // -drive id=MacDVD,if=none,snapshot=on,file=%s
- type SGuestCdrom struct {
- Id string
- Path string
- Ordinal int64
- BootIndex *int8
- Ide *IDEDevice `json:",omitempty"`
- Scsi *SCSIDevice `json:",omitempty"`
- DriveOptions map[string]string `json:",omitempty"`
- }
- type SGuestFloppy struct {
- Id string
- Path string
- Ordinal int64
- Floppy *FloppyDevice `json:",omitempty"`
- DriveOptions map[string]string `json:",omitempty"`
- }
- type SGuestNetwork struct {
- api.GuestnetworkJsonDesc
- Pci *PCIDevice `json:",omitempty"`
- }
- type VFIODevice struct {
- *PCIDevice
- HostAddr string
- XVga bool
- }
- type SGuestIsolatedDevice struct {
- api.IsolatedDeviceJsonDesc
- VfioDevs []*VFIODevice `json:",omitempty"`
- Usb *UsbDevice
- }
- type SGuestVga struct {
- *PCIDevice `json:",omitempty"`
- }
- type SGuestRng struct {
- *PCIDevice `json:",omitempty"`
- RngRandom *Object
- }
- type SoundCard struct {
- *PCIDevice `json:",omitempty"`
- Codec *Codec
- }
- type Codec struct {
- Id string
- Type string
- Cad int
- }
- type SSpiceDesc struct {
- // Intel High Definition Audio
- IntelHDA *SoundCard
- // vdagent
- VdagentSerial *SGuestVirtioSerial
- Vdagent *CharDev
- VdagentSerialPort *VirtSerialPort
- // usb redirect
- UsbRedirct *UsbRedirctDesc
- Options map[string]string `json:",omitempty"`
- }
- type UsbMasterBus struct {
- Masterbus string
- Port int
- }
- type UsbController struct {
- *PCIDevice
- MasterBus *UsbMasterBus `json:",omitempty"`
- }
- type UsbAddr struct {
- Bus int
- Port int
- }
- type UsbDevice struct {
- *UsbAddr
- Id string
- DevType string
- Options map[string]string `json:",omitempty"`
- }
- type UsbRedirctDesc struct {
- // EHCI adapter: Enhanced Host Controller Interface, USB2.0
- // Depends on UHCI to support full of usb devices
- EHCI1 *UsbController
- // UHCI controllers: Universal Host Controller Interface, USB 1.0, 1.1
- UHCI1 *UsbController
- UHCI2 *UsbController
- UHCI3 *UsbController
- UsbRedirDev1 *UsbRedir
- UsbRedirDev2 *UsbRedir
- }
- type UsbRedir struct {
- Id string
- Source *CharDev
- }
- type SGuestVdi struct {
- Spice *SSpiceDesc
- }
- type SGuestVirtioSerial struct {
- *PCIDevice
- }
- type SGuestVirtioScsi struct {
- *PCIDevice
- NumQueues *uint8 `json:"num_queues"`
- }
- type SGuestPvScsi struct {
- *PCIDevice
- }
- type SGuestAhciDevice struct {
- *PCIDevice
- }
- type SGuestProjectDesc struct {
- Tenant string
- TenantId string
- DomainId string
- ProjectDomain string
- }
- type SGuestRegionDesc struct {
- Zone string `json:"zone"`
- Domain string `json:"domain"`
- HostId string `json:"host_id"`
- Hostname string `json:"hostname"`
- HostAccessIp string `json:"host_access_ip"`
- HostEIP string `json:"host_eip"`
- }
- type SGuestControlDesc struct {
- IsDaemon bool
- IsMaster bool
- IsSlave bool
- // is volatile host meaning guest not running on this host right now
- IsVolatileHost bool
- ScalingGroupId string
- SrcIpCheck bool
- SrcMacCheck bool
- SecurityRules string
- AdminSecurityRules string
- NicSecgroups []*api.GuestnetworkSecgroupDesc `json:"nic_secgroups,omitempty"`
- EncryptKeyId string
- LightMode bool // light mode
- Hypervisor string
- }
- type SGuestMetaDesc struct {
- Name string
- Uuid string
- OsName string
- Pubkey string
- Keypair string
- Secgroup string
- Flavor string
- UserData string
- Metadata map[string]string
- ExtraOptions map[string]jsonutils.JSONObject
- }
- type SGuestContainerDesc struct {
- Containers []*host.ContainerDesc
- }
- type SGuestDesc struct {
- SGuestProjectDesc
- SGuestRegionDesc
- SGuestControlDesc
- SGuestHardwareDesc
- SGuestMetaDesc
- SGuestContainerDesc
- }
|