@celilo/cli 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -636,6 +636,23 @@ export class ProxmoxClient {
|
|
|
636
636
|
if (!result.success) return result;
|
|
637
637
|
return { success: true, data: findNodeForVmid(result.data, vmid) };
|
|
638
638
|
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Power-cycle a guest so PENDING config changes take effect (ISS-0150). A
|
|
642
|
+
* cpu/memory change Terraform writes to the VM config is "pending" until the
|
|
643
|
+
* QEMU process is recreated; `qm reboot` does a shutdown+start that applies it.
|
|
644
|
+
* Returns the UPID and waits for the task to finish.
|
|
645
|
+
*/
|
|
646
|
+
async rebootVm(node: string, vmid: number): Promise<ProxmoxResult<string>> {
|
|
647
|
+
const res = await makeProxmoxPost<string>(
|
|
648
|
+
this.credentials,
|
|
649
|
+
`/nodes/${node}/qemu/${vmid}/status/reboot`,
|
|
650
|
+
{},
|
|
651
|
+
);
|
|
652
|
+
if (!res.success) return res;
|
|
653
|
+
await pollTaskUntilDone(this.credentials, node, res.data, 300_000);
|
|
654
|
+
return res;
|
|
655
|
+
}
|
|
639
656
|
}
|
|
640
657
|
|
|
641
658
|
/**
|
|
@@ -200,12 +200,12 @@ export async function handleProxmoxInstanceResize(
|
|
|
200
200
|
.where(and(eq(moduleSystems.moduleId, s.moduleId), eq(moduleSystems.name, s.name)))
|
|
201
201
|
.run();
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
);
|
|
203
|
+
const effCpu = reqCpu ?? target.cpu;
|
|
204
|
+
const effMem = reqMemory ?? target.memory;
|
|
205
|
+
console.log(`✓ Canonical size updated: ${name} → ${effCpu ?? '?'}c / ${effMem ?? '?'}MB`);
|
|
206
206
|
|
|
207
207
|
// Reconcile declaratively: redeploy the owning module — its Terraform now reads
|
|
208
|
-
// the updated system size and
|
|
208
|
+
// the updated system size and writes it to the Proxmox VM config.
|
|
209
209
|
console.log(`▸ Reconciling ${target.moduleId} (Terraform apply)…`);
|
|
210
210
|
const deployed = await deployModule(target.moduleId, db, {});
|
|
211
211
|
if (!deployed.success) {
|
|
@@ -214,6 +214,20 @@ export async function handleProxmoxInstanceResize(
|
|
|
214
214
|
return { success: false, error: e };
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
// A cpu/memory change is written to the VM config as PENDING — the running
|
|
218
|
+
// QEMU keeps its old allocation until a power-cycle. Terraform alone won't do
|
|
219
|
+
// that, so the resize op owns the stop/start (already operator-approved above).
|
|
220
|
+
if (decision.needsReboot && node) {
|
|
221
|
+
console.log(`▸ Power-cycling ${name} (vmid ${vmid}) to apply the new size…`);
|
|
222
|
+
const rebooted = await client.rebootVm(node, vmid);
|
|
223
|
+
if (!rebooted.success) {
|
|
224
|
+
const e = `Config updated + reconciled, but the power-cycle failed: ${rebooted.message}. The new size applies on the next stop/start of vmid ${vmid}.`;
|
|
225
|
+
console.log(`✗ ${e}`);
|
|
226
|
+
return { success: false, error: e };
|
|
227
|
+
}
|
|
228
|
+
console.log(' ✓ Power-cycled; new size is live.');
|
|
229
|
+
}
|
|
230
|
+
|
|
217
231
|
console.log(`✓ Resized ${name} and reconciled ${target.moduleId}.`);
|
|
218
232
|
return { success: true, message: `resized ${name}` };
|
|
219
233
|
}
|