2023-11-06 18:38:24 +03:00
|
|
|
# Compute
|
|
|
|
|
2023-12-13 01:42:50 +03:00
|
|
|
Compute instances management library.
|
2023-11-06 18:38:24 +03:00
|
|
|
|
|
|
|
## Docs
|
|
|
|
|
2024-01-13 00:45:30 +03:00
|
|
|
Documantation is available [here](https://nixhacks.net/hstack/compute/master/index.html).
|
|
|
|
To build actual docs run `make serve-docs`. See [Development](#development) below.
|
2023-11-06 18:38:24 +03:00
|
|
|
|
|
|
|
## Roadmap
|
|
|
|
|
|
|
|
- [x] Create instances
|
2023-12-03 23:25:34 +03:00
|
|
|
- [x] CDROM
|
2023-12-13 01:42:50 +03:00
|
|
|
- [x] cloud-init for provisioning instances
|
2023-12-03 23:25:34 +03:00
|
|
|
- [x] Power management
|
|
|
|
- [x] Pause and resume
|
2023-11-06 18:38:24 +03:00
|
|
|
- [x] vCPU hotplug
|
2023-11-09 22:35:19 +03:00
|
|
|
- [x] Memory hotplug
|
2023-11-06 18:38:24 +03:00
|
|
|
- [x] Hot disk resize [not tested]
|
|
|
|
- [x] CPU customization (emulation mode, model, vendor, features)
|
2023-12-13 01:42:50 +03:00
|
|
|
- [x] CPU topology customization
|
2023-11-06 18:38:24 +03:00
|
|
|
- [ ] BIOS/UEFI settings
|
|
|
|
- [x] Device attaching
|
2023-11-11 02:28:46 +03:00
|
|
|
- [x] Device detaching
|
2023-11-06 18:38:24 +03:00
|
|
|
- [ ] GPU passthrough
|
|
|
|
- [ ] CPU guarantied resource percent support
|
|
|
|
- [x] QEMU Guest Agent management
|
2023-12-03 23:25:34 +03:00
|
|
|
- [ ] Resource usage stats
|
|
|
|
- [x] SSH-keys management
|
2023-11-11 02:28:46 +03:00
|
|
|
- [x] Setting user passwords in guest
|
2023-11-06 18:38:24 +03:00
|
|
|
- [x] QCOW2 disks support
|
|
|
|
- [ ] ZVOL support
|
|
|
|
- [ ] Network disks support
|
|
|
|
- [ ] Images service integration (Images service is not implemented yet)
|
|
|
|
- [ ] Manage storage pools
|
2023-11-09 20:33:13 +03:00
|
|
|
- [ ] Idempotency
|
|
|
|
- [ ] CLI [in progress]
|
2023-11-09 22:35:19 +03:00
|
|
|
- [ ] HTTP API
|
2023-12-03 23:25:34 +03:00
|
|
|
- [ ] Migrations
|
|
|
|
- [ ] Snapshots
|
|
|
|
- [ ] Backups
|
2023-11-09 22:35:19 +03:00
|
|
|
- [ ] LXC
|
2023-12-03 23:25:34 +03:00
|
|
|
- [ ] Attaching CDROM from sources: block, (http|https|ftp|ftps|tftp)://
|
2023-12-13 01:42:50 +03:00
|
|
|
- [ ] Instance clones (thin, fat)
|
2024-01-13 00:45:30 +03:00
|
|
|
- [ ] MicroVM
|
2023-11-09 01:17:50 +03:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
2023-11-09 20:33:13 +03:00
|
|
|
Python 3.11+ is required.
|
|
|
|
|
2023-11-09 01:17:50 +03:00
|
|
|
Install [poetry](https://python-poetry.org/), clone this repository and run:
|
|
|
|
|
|
|
|
```
|
|
|
|
poetry install --with dev --with docs
|
|
|
|
```
|
2023-11-23 02:34:02 +03:00
|
|
|
|
2024-01-13 00:45:30 +03:00
|
|
|
## Build Debian package
|
2023-11-23 02:34:02 +03:00
|
|
|
|
|
|
|
Install Docker first, then run:
|
|
|
|
|
|
|
|
```
|
|
|
|
make build-deb
|
|
|
|
```
|
|
|
|
|
|
|
|
`compute` and `compute-doc` packages will built. See packaging/build directory.
|
|
|
|
|
2024-01-13 00:45:30 +03:00
|
|
|
## Installation
|
2023-11-23 02:34:02 +03:00
|
|
|
|
2023-12-13 01:42:50 +03:00
|
|
|
See [Installation](https://nixhacks.net/hstack/compute/master/installation.html).
|
2023-11-23 02:34:02 +03:00
|
|
|
|
2024-01-13 00:45:30 +03:00
|
|
|
## Basic usage
|
2023-11-23 02:34:02 +03:00
|
|
|
|
|
|
|
To get help run:
|
|
|
|
|
|
|
|
```
|
|
|
|
compute --help
|
|
|
|
```
|
|
|
|
|
2023-12-13 01:42:50 +03:00
|
|
|
See [CLI docs](https://nixhacks.net/hstack/compute/master/cli/index.html) for more info.
|
|
|
|
|
2023-11-23 02:34:02 +03:00
|
|
|
Also you can use `compute` as generic Python library. For example:
|
|
|
|
|
|
|
|
```python
|
2023-12-13 01:42:50 +03:00
|
|
|
import compute
|
2023-11-23 02:34:02 +03:00
|
|
|
|
2023-12-13 01:42:50 +03:00
|
|
|
with compute.Session() as session:
|
2023-11-23 02:34:02 +03:00
|
|
|
instance = session.get_instance('myinstance')
|
|
|
|
if not instance.is_running():
|
|
|
|
instance.start()
|
|
|
|
else:
|
|
|
|
print('instance is already running')
|
|
|
|
```
|