Skip to content

Commit 8ac1dfd

Browse files
feat(gservice): restore PoolAgentDriver, add back gcl_sdk libvirt extra
Wires gcl_sdk's PoolAgentDriver into GeneralService as a universal agent, so a MachinePool with driver_spec kind "libvirt" is actually managed again (previously removed as dead code before the pool driver existed in gcl_sdk). This is the counterpart to LocalPoolAgentDriver: it runs inside core itself and reaches libvirt over the network, instead of via a dedicated agent on the hypervisor host. Requires the gcl_sdk[libvirt] extra for the libvirt python bindings. Note: uv.lock is stale until a gcl_sdk release with the libvirt extra is published (the currently locked 3.1.1 predates it); regenerate the lock once that's out.
1 parent 1838631 commit 8ac1dfd

4 files changed

Lines changed: 18 additions & 3 deletions

File tree

docs/usage/local_deployment.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Run `exordos bootstrap --help` to see all available options. The most important
8686
| `--admin-password TEXT` | Password for the admin user. If not provided, a password is generated automatically. |
8787
| `--save-admin-password-file TEXT` | Save the admin password to a file instead of printing it to the console. |
8888
| `--ssh-public-key PATH` | Path to a public SSH key to inject into the VM. Can be specified multiple times. |
89-
| `--hyper-connection-uri TEXT` | Connection URI for the hypervisor, e.g. `qemu+tcp://10.0.0.1/system` or `qemu+ssh://user@10.0.0.1/system`. |
89+
| `--pool-agent-placement [core\|local]` | Where the pool agent that drives the hypervisor's libvirt runs. `core` (default) runs it inside core's own services, reaching libvirt over the network. `local` installs a dedicated universal agent on this host that talks to the local libvirt socket directly. |
90+
| `--hyper-connection-uri TEXT` | Connection URI for the hypervisor, e.g. `qemu+tcp://10.0.0.1/system` or `qemu+ssh://user@10.0.0.1/system`. Only used with `--pool-agent-placement=core`; defaults to the main network's first address (`qemu+tcp`) if not set. |
9091
| `--hyper-storage-pool TEXT` | Libvirt storage pool to use for VM disks. Defaults to `default`. |
9192
| `--force` / `-f` | Force rebuild if the output already exists. |
9293

docs/usage/local_deployment.ru.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ exordos bootstrap -i https://repo.exordos.com/exordos-elements/core/0.0.6/ -m co
8686
| `--admin-password TEXT` | Пароль администратора. Если не задан, генерируется автоматически. |
8787
| `--save-admin-password-file TEXT` | Сохранить пароль администратора в файл вместо вывода в консоль. |
8888
| `--ssh-public-key PATH` | Путь к публичному SSH-ключу для добавления в виртуальную машину. Можно указать несколько раз. |
89-
| `--hyper-connection-uri TEXT` | URI подключения к гипервизору, например `qemu+tcp://10.0.0.1/system` или `qemu+ssh://user@10.0.0.1/system`. |
89+
| `--pool-agent-placement [core\|local]` | Где будет жить пул-агент, управляющий libvirt гипервизора. `core` (по умолчанию) — агент работает внутри сервисов core и обращается к libvirt по сети. `local` — на этом хосте устанавливается отдельный универсальный агент, который обращается к локальному сокету libvirt напрямую. |
90+
| `--hyper-connection-uri TEXT` | URI подключения к гипервизору, например `qemu+tcp://10.0.0.1/system` или `qemu+ssh://user@10.0.0.1/system`. Используется только с `--pool-agent-placement=core`; если не задан, по умолчанию берётся первый адрес основной сети (`qemu+tcp`). |
9091
| `--hyper-storage-pool TEXT` | Пул хранилища libvirt для дисков виртуальных машин. По умолчанию: `default`. |
9192
| `--force` / `-f` | Принудительная пересборка, если результат уже существует. |
9293

exordos_core/gservice/service.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from gcl_sdk.agents.universal.clients.backend import db as db_back
2424
from gcl_sdk.agents.universal.clients.orch import db as orch_db
2525
from gcl_sdk.agents.universal.drivers import core as ua_core_drivers
26+
from gcl_sdk.agents.universal.drivers import pool as ua_pool_drivers
2627
from gcl_sdk.agents.universal.services import agent as ua_agent_service
2728
from gcl_sdk.agents.universal.services import scheduler as ua_scheduler_service
2829
from gcl_sdk.events import constants as event_c
@@ -102,6 +103,17 @@ def __init__(self, iter_min_period=3, iter_pause=0.1):
102103
volume_builder = volume_builder_svc.VolumeBuilderService(
103104
iter_min_period=iter_min_period
104105
)
106+
pool_driver = ua_pool_drivers.PoolAgentDriver(
107+
meta_file="/var/lib/exordos/exordos_core/pool_agent_meta.json"
108+
)
109+
machine_pool_agent = ua_agent_service.UniversalAgentService(
110+
agent_uuid=sys_uuid.uuid5(ua_utils.system_uuid(), "machine_pool_agent"),
111+
orch_client=orch_db.DatabaseOrchClient(),
112+
caps_drivers=[pool_driver],
113+
facts_drivers=[],
114+
iter_min_period=iter_min_period,
115+
payload_path=None,
116+
)
105117
set_builder = set_builder_svc.NodeSetBuilderService(
106118
instance_model=node_set_models.NodeSet,
107119
project_id=nc.NODE_SET_PROJECT,
@@ -217,6 +229,7 @@ def __init__(self, iter_min_period=3, iter_pause=0.1):
217229
pool_builder_service,
218230
node_builder,
219231
volume_builder,
232+
machine_pool_agent,
220233
cfg_service,
221234
service_builder,
222235
net_lb_iaas_builder,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies = [
2828
"Jinja2>=3.1.5,<4.0.0", # BSD License (BSD-3-Clause)
2929
"izulu>=0.50.0,<1.0.0", # MIT License
3030
"gcl_iam>=1.3.2,<2.0.0", # Apache-2.0
31-
"gcl_sdk>=3.1.0,<4.0.0", # Apache-2.0
31+
"gcl_sdk[libvirt]>=3.1.0,<4.0.0", # Apache-2.0
3232
"gcl_certbot_plugin>=0.0.9,<1.0.0", # Apache-2.0
3333
"pyotp>=2.9.0,<3.0.0", # MIT License
3434
"pyyaml>=6.0.0,<7.0.0", # MIT

0 commit comments

Comments
 (0)