[go学習]libvirt-goで提供できる虚機情報
16623 ワード
libvirt-goソースのdomainをひっくり返して、すべてgetできる内容を見つけましたが、具体的なget操作はいくつかしか試していません.まずmarkで降りましょう.各urlはlibvirt-go対応libvirtのcバージョンのapiドキュメントであり、goにはドキュメントがないので、自分で手動で対応する必要があります.
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) func (d *Domain) GetName() (string, error)
b) Get the public name for that domain.
c) https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetName
3. func (d *Domain) GetState() (DomainState, int, error)
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState
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. func (d *Domain) GetVcpusFlags(flags DomainVcpuFlags) (int32, error)
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetVcpusFlags
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
}