https://github.com/null-none/py-kvm
Module for managing KVM hosts.
https://github.com/null-none/py-kvm
hosts kvm kvm-hypervisor python
Last synced: 12 months ago
JSON representation
Module for managing KVM hosts.
- Host: GitHub
- URL: https://github.com/null-none/py-kvm
- Owner: null-none
- License: unlicense
- Created: 2024-12-15T20:20:38.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-25T19:01:12.000Z (over 1 year ago)
- Last Synced: 2025-07-01T13:07:04.266Z (12 months ago)
- Topics: hosts, kvm, kvm-hypervisor, python
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-kvm
This module aims to manage KVM hypervisors. For this it use the unix module which allow to manage Unix-like systems, both locally and remotely, in the same by overloading class instances.
## Usage
```python
>>> from unix import Local, Remote, UnixError
>>> from unix.linux import Linux
>>> from kvm.hypervisor import Hypervisor
>>> import json
>>> localhost = Hypervisor(Linux(Local()))
>>> localhost.hypervisor.nodeinfo()
{'nb_cpu': 1,
'nb_threads_per_core': 2,
'memory': 16331936,
'numa_cells': 1,
'cpu_model': 'x86_64',
'nb_cores_per_cpu': 4,
'nb_cores': 8,
'cpu_freq': 1340}
>>> localhost.list_domains(all=True)
{'guest1': {'id': -1, 'state': 'shut off'}}
{'guest2': {'id': 1, 'state': 'running'}}
```