/*1.      虚拟cpu信息:
a)  Extract information about virtual CPUs of domain。
b)   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpus */
type DomainVcpuInfo struct {
   Number  uint32
   State   int32
   CpuTime uint64
   Cpu     int32
   CpuMap  []bool
}
/*
2.  得到主机名:
a)  
b)  Get the public name for that domain.
c)   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName */
func (d *Domain) GetName() (string, error) 
//3.    https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState  
func (d *Domain) GetState() (DomainState, int, error) 

//4.    得到主机Metadata信息:
//a)    
func (d *Domain) GetMetadata(tipus DomainMetadataType, uri string, flags DomainModificationImpact) (string, error)
//b)     https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMetadata 
//5.     https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags 
func (d *Domain) GetVcpusFlags(flags DomainVcpuFlags) (int32, error) 
//6.      虚拟机信息:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetInfo 
type DomainInfo struct {
   State     DomainState // 运行状态 
   MaxMem    uint64 // 允许的最大内存,KB
   Memory    uint64 // 主机内存,KB //TODO区别??
   NrVirtCpu uint // 虚机虚拟CPU个数
   CpuTime   uint64// CPU使用时间,ns
}

//7.     https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInterfaceAddresses 
 type DomainIPAddress struct {
   Type   int
   Addr   string
   Prefix uint
}

type DomainInterface struct {
   Name   string
   Hwaddr string
   Addrs  []DomainIPAddress
}
/*
8.  得到单个主机CPU使用相关的统计信息:
a)  Get statistics relating to CPU usage attributable to a single domain (in contrast to the statistics returned by virNodeGetCPUStats() for all processes on the host).
b)  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetCPUStats */
type DomainCPUStats struct {
   CpuTimeSet    bool
   CpuTime       uint64
   UserTimeSet   bool
   UserTime      uint64
   SystemTimeSet bool
   SystemTime    uint64
   VcpuTimeSet   bool
   VcpuTime      uint64
}

//9.     得到端口参数:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetInterfaceParameters 
type DomainInterfaceParameters struct {
   BandwidthInAverageSet  bool
   BandwidthInAverage     uint
   BandwidthInPeakSet     bool
   BandwidthInPeak        uint
   BandwidthInBurstSet    bool
   BandwidthInBurst       uint
   BandwidthInFloorSet    bool
   BandwidthInFloor       uint
   BandwidthOutAverageSet bool
   BandwidthOutAverage    uint
   BandwidthOutPeakSet    bool
   BandwidthOutPeak       uint
   BandwidthOutBurstSet   bool
   BandwidthOutBurst      uint
}

//10.   块设备状态:
// https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockStats 
type DomainBlockStats struct {
   RdBytesSet         bool
   RdBytes            int64 //读取字节数
   RdReqSet           bool
   RdReq              int64// 读取请求数
   RdTotalTimesSet    bool
   RdTotalTimes       int64 //读取花费总时间?
   WrBytesSet         bool
   WrBytes            int64 //写入字节数
   WrReqSet           bool
   WrReq              int64 //写入需求数
   WrTotalTimesSet    bool
   WrTotalTimes       int64 //写入花费总时间?
   FlushReqSet        bool
   FlushReq           int64 //刷新请求数
   FlushTotalTimesSet bool
   FlushTotalTimes    int64 //刷新花费总时间
   ErrsSet            bool
   Errs               int64 //出错次数
}

//11.    端口状态: https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainInterfaceStats 
type DomainInterfaceStats struct {
   RxBytesSet   bool
   RxBytes      int64 // 接收字节数
   RxPacketsSet bool
   RxPackets    int64 //接收包数
   RxErrsSet    bool
   RxErrs       int64 //接收出错次数
   RxDropSet    bool
   RxDrop       int64 //接收丢弃包数
   TxBytesSet   bool
   TxBytes      int64 //传输字节数
   TxPacketsSet bool
   TxPackets    int64 //传输包数
   TxErrsSet    bool
   TxErrs       int64 //传输出错次数
   TxDropSet    bool
   TxDrop       int64 //传输丢弃包数
}

//12.   主机内存策略是啥???:
//a)    Api下方有多种内存策略: https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMemoryStats 
type DomainMemoryStat struct {
   Tag int32
   Val uint64
}

//13.   得到当前主机的快照:
// https://libvirt.org/html/libvirt-libvirt-domain-snapshot.html#virDomainSnapshotCurrent 
type DomainSnapshot struct {
   ptr C.virDomainSnapshotPtr
}

//14.    检查点???:
//https://libvirt.org/html/libvirt-libvirt-domain-checkpoint.html#virDomainCheckpointLookupByName 
type DomainCheckpoint struct {
   ptr C.virDomainCheckpointPtr
}

//15.    块备份。这个所有方法里全都是只作为输入,没有作为输出。
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockCopy 
type DomainBlockCopyParameters struct {
   BandwidthSet   bool
   Bandwidth      uint64
   GranularitySet bool
   Granularity    uint
   BufSizeSet     bool
   BufSize        uint64
}

//16.    这个所有方法里全都是只作为输入,没有作为输出。
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainMigrate3 
type DomainMigrateParameters struct {
   URISet                    bool
   URI                       string
   DestNameSet               bool
   DestName                  string
   DestXMLSet                bool
   DestXML                   string
   PersistXMLSet             bool
   PersistXML                string
   BandwidthSet              bool
   Bandwidth                 uint64
   GraphicsURISet            bool
   GraphicsURI               string
   ListenAddressSet          bool
   ListenAddress             string
   MigrateDisksSet           bool
   MigrateDisks              []string
   DisksPortSet              bool
   DisksPort                 int
   CompressionSet            bool
   Compression               string
   CompressionMTLevelSet     bool
   CompressionMTLevel        int
   CompressionMTThreadsSet   bool
   CompressionMTThreads      int
   CompressionMTDThreadsSet  bool
   CompressionMTDThreads     int
   CompressionXBZRLECacheSet bool
   CompressionXBZRLECache    uint64
   AutoConvergeInitialSet    bool
   AutoConvergeInitial       int
   AutoConvergeIncrementSet  bool
   AutoConvergeIncrement     int
   ParallelConnectionsSet    bool
   ParallelConnections       int
}

//17.   Blkio参数???是啥:
// https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlkioParameters 
type DomainBlkioParameters struct {
   WeightSet          bool
   Weight             uint
   DeviceWeightSet    bool
   DeviceWeight       string
   DeviceReadIopsSet  bool
   DeviceReadIops     string
   DeviceWriteIopsSet bool
   DeviceWriteIops    string
   DeviceReadBpsSet   bool
   DeviceReadBps      string
   DeviceWriteBpsSet  bool
   DeviceWriteBps     string
}

//18.    块IO可调参数???:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockIoTune 
type DomainBlockIoTuneParameters struct {
   TotalBytesSecSet          bool
   TotalBytesSec             uint64
   ReadBytesSecSet           bool
   ReadBytesSec              uint64
   WriteBytesSecSet          bool
   WriteBytesSec             uint64
   TotalIopsSecSet           bool
   TotalIopsSec              uint64
   ReadIopsSecSet            bool
   ReadIopsSec               uint64
   WriteIopsSecSet           bool
   WriteIopsSec              uint64
   TotalBytesSecMaxSet       bool
   TotalBytesSecMax          uint64
   ReadBytesSecMaxSet        bool
   ReadBytesSecMax           uint64
   WriteBytesSecMaxSet       bool
   WriteBytesSecMax          uint64
   TotalIopsSecMaxSet        bool
   TotalIopsSecMax           uint64
   ReadIopsSecMaxSet         bool
   ReadIopsSecMax            uint64
   WriteIopsSecMaxSet        bool
   WriteIopsSecMax           uint64
   TotalBytesSecMaxLengthSet bool
   TotalBytesSecMaxLength    uint64
   ReadBytesSecMaxLengthSet  bool
   ReadBytesSecMaxLength     uint64
   WriteBytesSecMaxLengthSet bool
   WriteBytesSecMaxLength    uint64
   TotalIopsSecMaxLengthSet  bool
   TotalIopsSecMaxLength     uint64
   ReadIopsSecMaxLengthSet   bool
   ReadIopsSecMaxLength      uint64
   WriteIopsSecMaxLengthSet  bool
   WriteIopsSecMaxLength     uint64
   SizeIopsSecSet            bool
   SizeIopsSec               uint64
   GroupNameSet              bool
   GroupName                 string
}

//19.     请求给定磁盘的块作业信息:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetBlockJobInfo 
type DomainBlockJobInfo struct {
   Type      DomainBlockJobType
   Bandwidth uint64
   Cur       uint64
   End       uint64
}

//20.    主机控制接口当前状态的详细信息: 
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetControlInfo 
type DomainControlInfo struct {
   State     DomainControlState //控制状态,api中可选
   Details   int // 状态详细,api中可选
   StateTime uint64 // 当前状态持续时间
}

//21.    主机后台作业进度信息: 
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobInfo 
type DomainJobInfo struct {
   Type                      DomainJobType// Time is measured in milliseconds
   TimeElapsedSet            bool
   TimeElapsed               uint64 // Always set???
   TimeElapsedNetSet         bool
   TimeElapsedNet            uint64
   TimeRemainingSet          bool
   TimeRemaining             uint64 // 随type不同而不同
   DowntimeSet               bool
   Downtime                  uint64
   DowntimeNetSet            bool
   DowntimeNet               uint64
   SetupTimeSet              bool
   SetupTime                 uint64
   DataTotalSet              bool
   DataTotal                 uint64
   DataProcessedSet          bool
   DataProcessed             uint64
   DataRemainingSet          bool
   DataRemaining             uint64 //同time remaining,见api
   MemTotalSet               bool
   MemTotal                  uint64
   MemProcessedSet           bool
   MemProcessed              uint64
   MemRemainingSet           bool
   MemRemaining              uint64
   MemConstantSet            bool
   MemConstant               uint64
   MemNormalSet              bool
   MemNormal                 uint64
   MemNormalBytesSet         bool
   MemNormalBytes            uint64
   MemBpsSet                 bool
   MemBps                    uint64
   MemDirtyRateSet           bool
   MemDirtyRate              uint64
   MemPageSizeSet            bool
   MemPageSize               uint64
   MemIterationSet           bool
   MemIteration              uint64
   DiskTotalSet              bool
   DiskTotal                 uint64
   DiskProcessedSet          bool
   DiskProcessed             uint64
   DiskRemainingSet          bool
   DiskRemaining             uint64
   DiskBpsSet                bool
   DiskBps                   uint64
   CompressionCacheSet       bool
   CompressionCache          uint64
   CompressionBytesSet       bool
   CompressionBytes          uint64
   CompressionPagesSet       bool
   CompressionPages          uint64
   CompressionCacheMissesSet bool
   CompressionCacheMisses    uint64
   CompressionOverflowSet    bool
   CompressionOverflow       uint64
   AutoConvergeThrottleSet   bool
   AutoConvergeThrottle      int
   OperationSet              bool
   Operation                 DomainJobOperationType
   MemPostcopyReqsSet        bool
   MemPostcopyReqs           uint64
}
/*
22.  得到最大物理内存:func (d *Domain) GetMaxMemory() (uint64, error)
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMaxMemory 
23. 客户机支持的最大虚拟cpu数量: func (d *Domain) GetMaxVcpus() (uint, error)
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMaxVcpus 
24.  得到系统类型:func (d *Domain) GetOSType() (string, error)
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetOSType 
25. 得到内存参数??:
 https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetMemoryParameters */
type DomainMemoryParameters struct {
   HardLimitSet     bool
   HardLimit        uint64
   SoftLimitSet     bool
   SoftLimit        uint64
   MinGuaranteeSet  bool
   MinGuarantee     uint64
   SwapHardLimitSet bool
   SwapHardLimit    uint64
}

//26.    得到numa参数??:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetNumaParameters 
type DomainNumaParameters struct {
   NodesetSet bool
   Nodeset    string
   ModeSet    bool
   Mode       DomainNumatuneMemMode
}

//27.    得到所有linux Perf事件:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetPerfEvents 
type DomainPerfEvents struct {
   CmtSet                   bool
   Cmt                      bool
   MbmtSet                  bool
   Mbmt                     bool
   MbmlSet                  bool
   Mbml                     bool
   CacheMissesSet           bool
   CacheMisses              bool
   CacheReferencesSet       bool
   CacheReferences          bool
   InstructionsSet          bool
   Instructions             bool
   CpuCyclesSet             bool
   CpuCycles                bool
   BranchInstructionsSet    bool
   BranchInstructions       bool
   BranchMissesSet          bool
   BranchMisses             bool
   BusCyclesSet             bool
   BusCycles                bool
   StalledCyclesFrontendSet bool
   StalledCyclesFrontend    bool
   StalledCyclesBackendSet  bool
   StalledCyclesBackend     bool
   RefCpuCyclesSet          bool
   RefCpuCycles             bool
   CpuClockSet              bool
   CpuClock                 bool
   TaskClockSet             bool
   TaskClock                bool
   PageFaultsSet            bool
   PageFaults               bool
   ContextSwitchesSet       bool
   ContextSwitches          bool
   CpuMigrationsSet         bool
   CpuMigrations            bool
   PageFaultsMinSet         bool
   PageFaultsMin            bool
   PageFaultsMajSet         bool
   PageFaultsMaj            bool
   AlignmentFaultsSet       bool
   AlignmentFaults          bool
   EmulationFaultsSet       bool
   EmulationFaults          bool
}

//28.    得到调度参数:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSchedulerParameters 
type DomainSchedulerParameters struct {
   Type              string
   CpuSharesSet      bool
   CpuShares         uint64
   GlobalPeriodSet   bool
   GlobalPeriod      uint64
   GlobalQuotaSet    bool
   GlobalQuota       int64
   VcpuPeriodSet     bool
   VcpuPeriod        uint64
   VcpuQuotaSet      bool
   VcpuQuota         int64
   EmulatorPeriodSet bool
   EmulatorPeriod    uint64
   EmulatorQuotaSet  bool
   EmulatorQuota     int64
   IothreadPeriodSet bool
   IothreadPeriod    uint64
   IothreadQuotaSet  bool
   IothreadQuota     int64
   WeightSet         bool
   Weight            uint
   CapSet            bool
   Cap               uint
   ReservationSet    bool
   Reservation       int64
   LimitSet          bool
   Limit             int64
   SharesSet         bool
   Shares            int
}

//29.    得到安全标签:
//https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetSecurityLabel 
type SecurityLabel struct {
   Label     string
   Enforcing bool
}
/*
30.  得到虚机系统时间: func (d *Domain) GetTime(flags uint32) (int64, uint, error)
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetTime 
31.  获取指定客户机和磁盘中每个装入的文件系统的映射信息列表:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetFSInfo */
type DomainFSInfo struct {
   MountPoint string
   Name       string
   FSType     string
   DevAlias   []string
}
/*
32.  查询主机中所有仿真器线程的CPU关联设置,将其存储在cpumap中:
a)  Query the CPU affinity setting of all emulator threads of domain, store it in cpumap.
b)  func (d *Domain) GetEmulatorPinInfo(flags DomainModificationImpact) ([]bool, error)
c)  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetEmulatorPinInfo 
33.  获取活动主机的IO线程,包括cpumap信息,以确定iothread在哪个CPU上运行的关联性:
a)  Fetch IOThreads of an active domain including the cpumap information to determine on which CPU the IOThread has affinity to run
b)  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetIOThreadInfo */
type DomainIOThreadInfo struct {
   IOThreadID uint
   CpuMap     []bool
}
/*
34.  查询主机中所有虚拟CPU的CPU关联设置,将其存储在CPU映射中:
a)  Query the CPU affinity setting of all virtual CPUs of domain, store it in cpumaps.
b)  func (d *Domain) GetVcpuPinInfo(flags DomainModificationImpact) ([][]bool, error)
c)  https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpuPinInfo 
35. 从客户机的角度向客户机端查询有关VCPUS的状态和信息。报告的数据取决于客户机端实现。:
a)  Queries the guest agent for state and information regarding vCPUs from guest's perspective. The reported data depends on the guest agent implementation.
b)   https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetGuestVcpus 
*/
type DomainGuestVcpus struct {
   VcpusSet      bool
   Vcpus         []bool
   OnlineSet     bool
   Online        []bool
   OfflinableSet bool
   Offlinable    []bool
}

//36.    得到安加载安全参数信息:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetLaunchSecurityInfo 
type DomainLaunchSecurityParameters struct {
   SEVMeasurementSet bool
   SEVMeasurement    string
}