3 for cb
,opaque
in self
.domainEventCallbacks
.items():
4 del self
.domainEventCallbacks
[cb
]
5 del self
.domainEventCallbacks
6 libvirtmod
.virConnectDomainEventDeregister(self
._o
, self
)
10 if self
._o
is not None:
11 libvirtmod
.virConnectClose(self
._o
)
14 def domainEventDeregister(self
, cb
):
15 """Removes a Domain Event Callback. De-registering for a
16 domain callback will disable delivery of this event type """
18 del self
.domainEventCallbacks
[cb
]
19 if len(self
.domainEventCallbacks
) == 0:
20 del self
.domainEventCallbacks
21 ret
= libvirtmod
.virConnectDomainEventDeregister(self
._o
, self
)
22 if ret
== -1: raise libvirtError ('virConnectDomainEventDeregister() failed', conn
=self
)
23 except AttributeError:
26 def domainEventRegister(self
, cb
, opaque
):
27 """Adds a Domain Event Callback. Registering for a domain
28 callback will enable delivery of the events """
30 self
.domainEventCallbacks
[cb
] = opaque
31 except AttributeError:
32 self
.domainEventCallbacks
= {cb
:opaque
}
33 ret
= libvirtmod
.virConnectDomainEventRegister(self
._o
, self
)
34 if ret
== -1: raise libvirtError ('virConnectDomainEventRegister() failed', conn
=self
)
36 def _dispatchDomainEventCallbacks(self
, dom
, event
, detail
):
37 """Dispatches events to python user domain event callbacks
40 for cb
,opaque
in self
.domainEventCallbacks
.items():
41 cb(self
, virDomain(self
, _obj
=dom
), event
, detail
, opaque
)
43 except AttributeError:
46 def _dispatchDomainEventLifecycleCallback(self
, dom
, event
, detail
, cbData
):
47 """Dispatches events to python user domain lifecycle event callbacks
50 opaque
= cbData
["opaque"]
52 cb(self
, virDomain(self
, _obj
=dom
), event
, detail
, opaque
)
55 def _dispatchDomainEventGenericCallback(self
, dom
, cbData
):
56 """Dispatches events to python user domain generic event callbacks
59 opaque
= cbData
["opaque"]
61 cb(self
, virDomain(self
, _obj
=dom
), opaque
)
64 def _dispatchDomainEventRTCChangeCallback(self
, dom
, offset
, cbData
):
65 """Dispatches events to python user domain RTC change event callbacks
68 opaque
= cbData
["opaque"]
70 cb(self
, virDomain(self
, _obj
=dom
), offset
,opaque
)
73 def _dispatchDomainEventWatchdogCallback(self
, dom
, action
, cbData
):
74 """Dispatches events to python user domain watchdog event callbacks
77 opaque
= cbData
["opaque"]
79 cb(self
, virDomain(self
, _obj
=dom
), action
, opaque
)
82 def _dispatchDomainEventIOErrorCallback(self
, dom
, srcPath
, devAlias
,
84 """Dispatches events to python user domain IO error event callbacks
87 opaque
= cbData
["opaque"]
89 cb(self
, virDomain(self
, _obj
=dom
), srcPath
, devAlias
, action
, opaque
)
92 def _dispatchDomainEventIOErrorReasonCallback(self
, dom
, srcPath
,
93 devAlias
, action
, reason
,
95 """Dispatches events to python user domain IO error event callbacks
98 opaque
= cbData
["opaque"]
100 cb(self
, virDomain(self
, _obj
=dom
), srcPath
, devAlias
, action
,
104 def _dispatchDomainEventGraphicsCallback(self
, dom
, phase
, localAddr
,
105 remoteAddr
, authScheme
, subject
,
107 """Dispatches events to python user domain graphics event callbacks
110 opaque
= cbData
["opaque"]
112 cb(self
, virDomain(self
, _obj
=dom
), phase
, localAddr
, remoteAddr
,
113 authScheme
, subject
, opaque
)
116 def _dispatchDomainEventBlockJobCallback(self
, dom
, disk
, type, status
, cbData
):
117 """Dispatches events to python user domain blockJob/blockJob2 event callbacks
121 opaque
= cbData
["opaque"]
123 cb(self
, virDomain(self
, _obj
=dom
), disk
, type, status
, opaque
)
125 except AttributeError:
128 def _dispatchDomainEventDiskChangeCallback(self
, dom
, oldSrcPath
, newSrcPath
, devAlias
, reason
, cbData
):
129 """Dispatches event to python user domain diskChange event callbacks
132 opaque
= cbData
["opaque"]
134 cb(self
, virDomain(self
, _obj
=dom
), oldSrcPath
, newSrcPath
, devAlias
, reason
, opaque
)
137 def _dispatchDomainEventTrayChangeCallback(self
, dom
, devAlias
, reason
, cbData
):
138 """Dispatches event to python user domain trayChange event callbacks
141 opaque
= cbData
["opaque"]
143 cb(self
, virDomain(self
, _obj
=dom
), devAlias
, reason
, opaque
)
146 def _dispatchDomainEventPMWakeupCallback(self
, dom
, reason
, cbData
):
147 """Dispatches event to python user domain pmwakeup event callbacks
150 opaque
= cbData
["opaque"]
152 cb(self
, virDomain(self
, _obj
=dom
), reason
, opaque
)
155 def _dispatchDomainEventPMSuspendCallback(self
, dom
, reason
, cbData
):
156 """Dispatches event to python user domain pmsuspend event callbacks
159 opaque
= cbData
["opaque"]
161 cb(self
, virDomain(self
, _obj
=dom
), reason
, opaque
)
164 def _dispatchDomainEventBalloonChangeCallback(self
, dom
, actual
, cbData
):
165 """Dispatches events to python user domain balloon change event callbacks
168 opaque
= cbData
["opaque"]
170 cb(self
, virDomain(self
, _obj
=dom
), actual
, opaque
)
173 def _dispatchDomainEventPMSuspendDiskCallback(self
, dom
, reason
, cbData
):
174 """Dispatches event to python user domain pmsuspend-disk event callbacks
177 opaque
= cbData
["opaque"]
179 cb(self
, virDomain(self
, _obj
=dom
), reason
, opaque
)
182 def _dispatchDomainEventDeviceRemovedCallback(self
, dom
, devAlias
, cbData
):
183 """Dispatches event to python user domain device removed event callbacks
186 opaque
= cbData
["opaque"]
188 cb(self
, virDomain(self
, _obj
=dom
), devAlias
, opaque
)
191 def _dispatchDomainEventTunableCallback(self
, dom
, params
, cbData
):
192 """Dispatches event to python user domain tunable event callbacks
195 opaque
= cbData
["opaque"]
197 cb(self
, virDomain(self
, _obj
=dom
), params
, opaque
)
200 def _dispatchDomainEventAgentLifecycleCallback(self
, dom
, state
, reason
, cbData
):
201 """Dispatches event to python user domain agent lifecycle event callback
205 opaque
= cbData
["opaque"]
207 cb(self
, virDomain(self
, _obj
=dom
), state
, reason
, opaque
)
210 def _dispatchDomainEventDeviceAddedCallback(self
, dom
, devAlias
, cbData
):
211 """Dispatches event to python user domain device added event callbacks
214 opaque
= cbData
["opaque"]
216 cb(self
, virDomain(self
, _obj
=dom
), devAlias
, opaque
)
219 def _dispatchDomainEventMigrationIterationCallback(self
, dom
, iteration
, cbData
):
220 """Dispatches event to python user domain migration iteration event callbacks
223 opaque
= cbData
["opaque"]
225 cb(self
, virDomain(self
, _obj
=dom
), iteration
, opaque
)
228 def _dispatchDomainEventJobCompletedCallback(self
, dom
, params
, cbData
):
229 """Dispatches event to python user domain job completed callbacks
232 opaque
= cbData
["opaque"]
234 cb(self
, virDomain(self
, _obj
=dom
), params
, opaque
)
237 def _dispatchDomainEventDeviceRemovalFailedCallback(self
, dom
, devAlias
, cbData
):
238 """Dispatches event to python user domain device removal failed event callbacks
241 opaque
= cbData
["opaque"]
243 cb(self
, virDomain(self
, _obj
=dom
), devAlias
, opaque
)
246 def _dispatchDomainEventMetadataChangeCallback(self
, dom
, mtype
, nsuri
, cbData
):
247 """Dispatches event to python user domain metadata change event callbacks
250 opaque
= cbData
["opaque"]
252 cb(self
, virDomain(self
, _obj
=dom
), mtype
, nsuri
, opaque
)
255 def _dispatchDomainEventBlockThresholdCallback(self
, dom
, dev
, path
, threshold
, excess
, cbData
):
256 """Dispatches event to python user domain block device threshold event callbacks
259 opaque
= cbData
["opaque"]
261 cb(self
, virDomain(self
, _obj
=dom
), dev
, path
, threshold
, excess
, opaque
)
264 def domainEventDeregisterAny(self
, callbackID
):
265 """Removes a Domain Event Callback. De-registering for a
266 domain callback will disable delivery of this event type """
268 ret
= libvirtmod
.virConnectDomainEventDeregisterAny(self
._o
, callbackID
)
269 if ret
== -1: raise libvirtError ('virConnectDomainEventDeregisterAny() failed', conn
=self
)
270 del self
.domainEventCallbackID
[callbackID
]
271 except AttributeError:
274 def _dispatchNetworkEventLifecycleCallback(self
, net
, event
, detail
, cbData
):
275 """Dispatches events to python user network lifecycle event callbacks
278 opaque
= cbData
["opaque"]
280 cb(self
, virNetwork(self
, _obj
=net
), event
, detail
, opaque
)
283 def networkEventDeregisterAny(self
, callbackID
):
284 """Removes a Network Event Callback. De-registering for a
285 network callback will disable delivery of this event type"""
287 ret
= libvirtmod
.virConnectNetworkEventDeregisterAny(self
._o
, callbackID
)
288 if ret
== -1: raise libvirtError ('virConnectNetworkEventDeregisterAny() failed', conn
=self
)
289 del self
.networkEventCallbackID
[callbackID
]
290 except AttributeError:
293 def networkEventRegisterAny(self
, net
, eventID
, cb
, opaque
):
294 """Adds a Network Event Callback. Registering for a network
295 callback will enable delivery of the events"""
296 if not hasattr(self
, 'networkEventCallbackID'):
297 self
.networkEventCallbackID
= {}
298 cbData
= { "cb": cb
, "conn": self
, "opaque": opaque
}
300 ret
= libvirtmod
.virConnectNetworkEventRegisterAny(self
._o
, None, eventID
, cbData
)
302 ret
= libvirtmod
.virConnectNetworkEventRegisterAny(self
._o
, net
._o
, eventID
, cbData
)
304 raise libvirtError ('virConnectNetworkEventRegisterAny() failed', conn
=self
)
305 self
.networkEventCallbackID
[ret
] = opaque
308 def domainEventRegisterAny(self
, dom
, eventID
, cb
, opaque
):
309 """Adds a Domain Event Callback. Registering for a domain
310 callback will enable delivery of the events """
311 if not hasattr(self
, 'domainEventCallbackID'):
312 self
.domainEventCallbackID
= {}
313 cbData
= { "cb": cb
, "conn": self
, "opaque": opaque
}
315 ret
= libvirtmod
.virConnectDomainEventRegisterAny(self
._o
, None, eventID
, cbData
)
317 ret
= libvirtmod
.virConnectDomainEventRegisterAny(self
._o
, dom
._o
, eventID
, cbData
)
319 raise libvirtError ('virConnectDomainEventRegisterAny() failed', conn
=self
)
320 self
.domainEventCallbackID
[ret
] = opaque
323 def _dispatchStoragePoolEventLifecycleCallback(self
, pool
, event
, detail
, cbData
):
324 """Dispatches events to python user storage pool
325 lifecycle event callbacks
328 opaque
= cbData
["opaque"]
330 cb(self
, virStoragePool(self
, _obj
=pool
), event
, detail
, opaque
)
333 def _dispatchStoragePoolEventGenericCallback(self
, pool
, cbData
):
334 """Dispatches events to python user storage pool
335 generic event callbacks
338 opaque
= cbData
["opaque"]
340 cb(self
, virStoragePool(self
, _obj
=pool
), opaque
)
343 def storagePoolEventDeregisterAny(self
, callbackID
):
344 """Removes a Storage Pool Event Callback. De-registering for a
345 storage pool callback will disable delivery of this event type"""
347 ret
= libvirtmod
.virConnectStoragePoolEventDeregisterAny(self
._o
, callbackID
)
348 if ret
== -1: raise libvirtError ('virConnectStoragePoolEventDeregisterAny() failed', conn
=self
)
349 del self
.storagePoolEventCallbackID
[callbackID
]
350 except AttributeError:
353 def storagePoolEventRegisterAny(self
, pool
, eventID
, cb
, opaque
):
354 """Adds a Storage Pool Event Callback. Registering for a storage pool
355 callback will enable delivery of the events"""
356 if not hasattr(self
, 'storagePoolEventCallbackID'):
357 self
.storagePoolEventCallbackID
= {}
358 cbData
= { "cb": cb
, "conn": self
, "opaque": opaque
}
360 ret
= libvirtmod
.virConnectStoragePoolEventRegisterAny(self
._o
, None, eventID
, cbData
)
362 ret
= libvirtmod
.virConnectStoragePoolEventRegisterAny(self
._o
, pool
._o
, eventID
, cbData
)
364 raise libvirtError ('virConnectStoragePoolEventRegisterAny() failed', conn
=self
)
365 self
.storagePoolEventCallbackID
[ret
] = opaque
368 def _dispatchNodeDeviceEventLifecycleCallback(self
, dev
, event
, detail
, cbData
):
369 """Dispatches events to python user node device
370 lifecycle event callbacks
373 opaque
= cbData
["opaque"]
375 cb(self
, virNodeDevice(self
, _obj
=dev
), event
, detail
, opaque
)
378 def _dispatchNodeDeviceEventGenericCallback(self
, dev
, cbData
):
379 """Dispatches events to python user node device
380 generic event callbacks
383 opaque
= cbData
["opaque"]
385 cb(self
, virNodeDevice(self
, _obj
=dev
), opaque
)
388 def nodeDeviceEventDeregisterAny(self
, callbackID
):
389 """Removes a Node Device Event Callback. De-registering for a
390 node device callback will disable delivery of this event type"""
392 ret
= libvirtmod
.virConnectNodeDeviceEventDeregisterAny(self
._o
, callbackID
)
393 if ret
== -1: raise libvirtError ('virConnectNodeDeviceEventDeregisterAny() failed', conn
=self
)
394 del self
.nodeDeviceEventCallbackID
[callbackID
]
395 except AttributeError:
398 def nodeDeviceEventRegisterAny(self
, dev
, eventID
, cb
, opaque
):
399 """Adds a Node Device Event Callback. Registering for a node device
400 callback will enable delivery of the events"""
401 if not hasattr(self
, 'nodeDeviceEventCallbackID'):
402 self
.nodeDeviceEventCallbackID
= {}
403 cbData
= { "cb": cb
, "conn": self
, "opaque": opaque
}
405 ret
= libvirtmod
.virConnectNodeDeviceEventRegisterAny(self
._o
, None, eventID
, cbData
)
407 ret
= libvirtmod
.virConnectNodeDeviceEventRegisterAny(self
._o
, dev
._o
, eventID
, cbData
)
409 raise libvirtError ('virConnectNodeDeviceEventRegisterAny() failed', conn
=self
)
410 self
.nodeDeviceEventCallbackID
[ret
] = opaque
413 def _dispatchSecretEventLifecycleCallback(self
, secret
, event
, detail
, cbData
):
414 """Dispatches events to python user secret lifecycle event callbacks
417 opaque
= cbData
["opaque"]
419 cb(self
, virSecret(self
, _obj
=secret
), event
, detail
, opaque
)
422 def _dispatchSecretEventGenericCallback(self
, secret
, cbData
):
423 """Dispatches events to python user secret generic event callbacks
426 opaque
= cbData
["opaque"]
428 cb(self
, virSecret(self
, _obj
=secret
), opaque
)
431 def secretEventDeregisterAny(self
, callbackID
):
432 """Removes a Secret Event Callback. De-registering for a
433 secret callback will disable delivery of this event type"""
435 ret
= libvirtmod
.virConnectSecretEventDeregisterAny(self
._o
, callbackID
)
436 if ret
== -1: raise libvirtError ('virConnectSecretEventDeregisterAny() failed', conn
=self
)
437 del self
.secretEventCallbackID
[callbackID
]
438 except AttributeError:
441 def secretEventRegisterAny(self
, secret
, eventID
, cb
, opaque
):
442 """Adds a Secret Event Callback. Registering for a secret
443 callback will enable delivery of the events"""
444 if not hasattr(self
, 'secretEventCallbackID'):
445 self
.secretEventCallbackID
= {}
446 cbData
= { "cb": cb
, "conn": self
, "opaque": opaque
}
448 ret
= libvirtmod
.virConnectSecretEventRegisterAny(self
._o
, None, eventID
, cbData
)
450 ret
= libvirtmod
.virConnectSecretEventRegisterAny(self
._o
, secret
._o
, eventID
, cbData
)
452 raise libvirtError ('virConnectSecretEventRegisterAny() failed', conn
=self
)
453 self
.secretEventCallbackID
[ret
] = opaque
456 def listAllDomains(self
, flags
=0):
457 """List all domains and returns a list of domain objects"""
458 ret
= libvirtmod
.virConnectListAllDomains(self
._o
, flags
)
460 raise libvirtError("virConnectListAllDomains() failed", conn
=self
)
464 retlist
.append(virDomain(self
, _obj
=domptr
))
468 def listAllStoragePools(self
, flags
=0):
469 """Returns a list of storage pool objects"""
470 ret
= libvirtmod
.virConnectListAllStoragePools(self
._o
, flags
)
472 raise libvirtError("virConnectListAllStoragePools() failed", conn
=self
)
476 retlist
.append(virStoragePool(self
, _obj
=poolptr
))
480 def listAllNetworks(self
, flags
=0):
481 """Returns a list of network objects"""
482 ret
= libvirtmod
.virConnectListAllNetworks(self
._o
, flags
)
484 raise libvirtError("virConnectListAllNetworks() failed", conn
=self
)
488 retlist
.append(virNetwork(self
, _obj
=netptr
))
492 def listAllInterfaces(self
, flags
=0):
493 """Returns a list of interface objects"""
494 ret
= libvirtmod
.virConnectListAllInterfaces(self
._o
, flags
)
496 raise libvirtError("virConnectListAllInterfaces() failed", conn
=self
)
500 retlist
.append(virInterface(self
, _obj
=ifaceptr
))
504 def listAllDevices(self
, flags
=0):
505 """Returns a list of host node device objects"""
506 ret
= libvirtmod
.virConnectListAllNodeDevices(self
._o
, flags
)
508 raise libvirtError("virConnectListAllNodeDevices() failed", conn
=self
)
512 retlist
.append(virNodeDevice(self
, _obj
=devptr
))
516 def listAllNWFilters(self
, flags
=0):
517 """Returns a list of network filter objects"""
518 ret
= libvirtmod
.virConnectListAllNWFilters(self
._o
, flags
)
520 raise libvirtError("virConnectListAllNWFilters() failed", conn
=self
)
523 for filter_ptr
in ret
:
524 retlist
.append(virNWFilter(self
, _obj
=filter_ptr
))
528 def listAllSecrets(self
, flags
=0):
529 """Returns a list of secret objects"""
530 ret
= libvirtmod
.virConnectListAllSecrets(self
._o
, flags
)
532 raise libvirtError("virConnectListAllSecrets() failed", conn
=self
)
535 for secret_ptr
in ret
:
536 retlist
.append(virSecret(self
, _obj
=secret_ptr
))
540 def _dispatchCloseCallback(self
, reason
, cbData
):
541 """Dispatches events to python user close callback"""
543 opaque
= cbData
["opaque"]
545 cb(self
, reason
, opaque
)
549 def unregisterCloseCallback(self
):
550 """Removes a close event callback"""
551 ret
= libvirtmod
.virConnectUnregisterCloseCallback(self
._o
)
552 if ret
== -1: raise libvirtError ('virConnectUnregisterCloseCallback() failed', conn
=self
)
554 def registerCloseCallback(self
, cb
, opaque
):
555 """Adds a close event callback, providing a notification
556 when a connection fails / closes"""
557 cbData
= { "cb": cb
, "conn": self
, "opaque": opaque
}
558 ret
= libvirtmod
.virConnectRegisterCloseCallback(self
._o
, cbData
)
560 raise libvirtError ('virConnectRegisterCloseCallback() failed', conn
=self
)
563 def createXMLWithFiles(self
, xmlDesc
, files
, flags
=0):
564 """Launch a new guest domain, based on an XML description similar
565 to the one returned by virDomainGetXMLDesc()
566 This function may require privileged access to the hypervisor.
567 The domain is not persistent, so its definition will disappear when it
568 is destroyed, or if the host is restarted (see virDomainDefineXML() to
569 define persistent domains).
571 @files provides an array of file descriptors which will be
572 made available to the 'init' process of the guest. The file
573 handles exposed to the guest will be renumbered to start
574 from 3 (ie immediately following stderr). This is only
575 supported for guests which use container based virtualization
578 If the VIR_DOMAIN_START_PAUSED flag is set, the guest domain
579 will be started, but its CPUs will remain paused. The CPUs
580 can later be manually started using virDomainResume.
582 If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest
583 domain will be automatically destroyed when the virConnectPtr
584 object is finally released. This will also happen if the
585 client application crashes / loses its connection to the
586 libvirtd daemon. Any domains marked for auto destroy will
587 block attempts at migration, save-to-file, or snapshots. """
588 ret
= libvirtmod
.virDomainCreateXMLWithFiles(self
._o
, xmlDesc
, files
, flags
)
589 if ret
is None:raise libvirtError('virDomainCreateXMLWithFiles() failed', conn
=self
)
590 __tmp
= virDomain(self
,_obj
=ret
)
593 def getAllDomainStats(self
, stats
= 0, flags
=0):
594 """Query statistics for all domains on a given connection.
596 Report statistics of various parameters for a running VM according to @stats
597 field. The statistics are returned as an array of structures for each queried
598 domain. The structure contains an array of typed parameters containing the
599 individual statistics. The typed parameter name for each statistic field
600 consists of a dot-separated string containing name of the requested group
601 followed by a group specific description of the statistic value.
603 The statistic groups are enabled using the @stats parameter which is a
604 binary-OR of enum virDomainStatsTypes. The following groups are available
605 (although not necessarily implemented for each hypervisor):
607 VIR_DOMAIN_STATS_STATE: Return domain state and reason for entering that
608 state. The typed parameter keys are in this format:
609 "state.state" - state of the VM, returned as int from virDomainState enum
610 "state.reason" - reason for entering given state, returned as int from
611 virDomain*Reason enum corresponding to given state.
613 Using 0 for @stats returns all stats groups supported by the given
616 Specifying VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS as @flags makes
617 the function return error in case some of the stat types in @stats were
618 not recognized by the daemon.
620 Similarly to virConnectListAllDomains, @flags can contain various flags to
621 filter the list of domains to provide stats for.
623 VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE selects online domains while
624 VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE selects offline ones.
626 VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT and
627 VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT allow to filter the list
628 according to their persistence.
630 To filter the list of VMs by domain state @flags can contain
631 VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING,
632 VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED,
633 VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF and/or
634 VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER for all other states. """
635 ret
= libvirtmod
.virConnectGetAllDomainStats(self
._o
, stats
, flags
)
637 raise libvirtError("virConnectGetAllDomainStats() failed", conn
=self
)
641 record
= (virDomain(self
, _obj
=elem
[0]) , elem
[1])
642 retlist
.append(record
)
646 def domainListGetStats(self
, doms
, stats
=0, flags
=0):
647 """ Query statistics for given domains.
649 Report statistics of various parameters for a running VM according to @stats
650 field. The statistics are returned as an array of structures for each queried
651 domain. The structure contains an array of typed parameters containing the
652 individual statistics. The typed parameter name for each statistic field
653 consists of a dot-separated string containing name of the requested group
654 followed by a group specific description of the statistic value.
656 The statistic groups are enabled using the @stats parameter which is a
657 binary-OR of enum virDomainStatsTypes. The following groups are available
658 (although not necessarily implemented for each hypervisor):
660 VIR_DOMAIN_STATS_STATE: Return domain state and reason for entering that
661 state. The typed parameter keys are in this format:
662 "state.state" - state of the VM, returned as int from virDomainState enum
663 "state.reason" - reason for entering given state, returned as int from
664 virDomain*Reason enum corresponding to given state.
666 Using 0 for @stats returns all stats groups supported by the given
669 Specifying VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS as @flags makes
670 the function return error in case some of the stat types in @stats were
671 not recognized by the daemon.
673 Get statistics about domains provided as a list in @doms. @stats is
674 a bit field selecting requested statistics types."""
677 if not isinstance(dom
, virDomain
):
678 raise libvirtError("domain list contains non-domain elements", conn
=self
)
680 domlist
.append(dom
._o
)
682 ret
= libvirtmod
.virDomainListGetStats(self
._o
, domlist
, stats
, flags
)
684 raise libvirtError("virDomainListGetStats() failed", conn
=self
)
688 record
= (virDomain(self
, _obj
=elem
[0]) , elem
[1])
689 retlist
.append(record
)