various improvements

This commit is contained in:
ge
2023-11-23 02:34:02 +03:00
parent b9d089dd78
commit 05f90b14f2
200 changed files with 15968 additions and 84 deletions

View File

@ -0,0 +1,93 @@
# compute bash completion script
_compute_root_cmd="
--version
--verbose
--connect
--log-level
init
exec
ls
start
shutdown
reboot
reset
powrst
pause
resume
status
setvcpus
setmem
setpasswd"
_compute_init_opts=""
_compute_exec_opts="
--timeout
--executable
--env
--no-join-args"
_compute_ls_opts=""
_compute_start_opts=""
_compute_shutdown_opts="--method"
_compute_reboot_opts=""
_compute_reset_opts=""
_compute_powrst_opts=""
_compute_pause_opts=""
_compute_resume_opts=""
_compute_status_opts=""
_compute_setvcpus_opts=""
_compute_setmem_opts=""
_compute_setpasswd_opts="--encrypted"
_compute_complete_instances()
{
for file in /etc/libvirt/qemu/*.xml; do
nodir="${file##*/}"
printf '%s ' "${nodir//\.xml}"
done
}
_compute_compreply()
{
if [[ "$current" = [a-z]* ]]; then
_compute_compwords="$(_compute_complete_instances)"
else
_compute_compwords="$*"
fi
COMPREPLY=($(compgen -W "$_compute_compwords" -- "$current"))
}
_compute_complete()
{
local current previous nshift
current="${COMP_WORDS[COMP_CWORD]}"
case "$COMP_CWORD" in
1) COMPREPLY=($(compgen -W "$_compute_root_cmd" -- "$current"))
;;
2|3|4|5)
nshift=$((COMP_CWORD-1))
previous="${COMP_WORDS[COMP_CWORD-nshift]}"
case "$previous" in
init) COMPREPLY=($(compgen -f -- "$current"));;
exec) _compute_compreply "$_compute_exec_opts";;
ls) COMPREPLY=($(compgen -W "$_compute_ls_opts" -- "$current"));;
start) _compute_compreply "$_compute_start_opts";;
shutdown) _compute_compreply "$_compute_shutdown_opts";;
reboot) _compute_compreply "$_compute_reboot_opts";;
reset) _compute_compreply "$_compute_reset_opts";;
powrst) _compute_compreply "$_compute_powrst_opts";;
pause) _compute_compreply "$_compute_pause_opts";;
resume) _compute_compreply "$_compute_resume_opts";;
status) _compute_compreply "$_compute_status_opts";;
setvcpus) _compute_compreply "$_compute_setvcpus_opts";;
setmem) _compute_compreply "$_compute_setmem_opts";;
setpasswd) _compute_compreply "$_compute_setpasswd_opts";;
*) COMPREPLY=()
esac
;;
*) COMPREPLY=($(compgen -W "$_compute_compwords" -- "$current"))
esac
}
complete -F _compute_complete compute
# vim: ft=bash

View File

@ -0,0 +1,65 @@
# Compute
Compute instances management library and tools.
## Docs
Run `make serve-docs`. See [Development](#development) below.
## Roadmap
- [x] Create instances
- [ ] CDROM
- [ ] cloud-init for provisioning instances
- [x] Instance power management
- [x] Instance pause and resume
- [x] vCPU hotplug
- [x] Memory hotplug
- [x] Hot disk resize [not tested]
- [ ] CPU topology customization
- [x] CPU customization (emulation mode, model, vendor, features)
- [ ] BIOS/UEFI settings
- [x] Device attaching
- [x] Device detaching
- [ ] GPU passthrough
- [ ] CPU guarantied resource percent support
- [x] QEMU Guest Agent management
- [ ] Instance resources usage stats
- [ ] SSH-keys management
- [x] Setting user passwords in guest
- [x] QCOW2 disks support
- [ ] ZVOL support
- [ ] Network disks support
- [ ] Images service integration (Images service is not implemented yet)
- [ ] Manage storage pools
- [ ] Idempotency
- [ ] CLI [in progress]
- [ ] HTTP API
- [ ] Instance migrations
- [ ] Instance snapshots
- [ ] Instance backups
- [ ] LXC
## Development
Python 3.11+ is required.
Install [poetry](https://python-poetry.org/), clone this repository and run:
```
poetry install --with dev --with docs
```
# Build Debian package
Install Docker first, then run:
```
make build-deb
```
`compute` and `compute-doc` packages will built. See packaging/build directory. Packages can be installed via `dpkg` or `apt-get`:
```
apt-get install ./compute*.deb
```

View File

@ -0,0 +1,32 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://git.lulzette.ru/hstack/compute
Upstream-Name: compute
Files:
*
Copyright:
2023 ge <ge@nixhacks.net>
License: GPL-3.0+
Files:
debian/*
Copyright:
2023 ge <ge@nixhacks.net>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Comment:
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".