initial commit

This commit is contained in:
TheOnlyMace
2026-05-17 13:26:14 +02:00
commit 75299b723d
176 changed files with 20327 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Services\Hosting\Reinstall;
use App\Jobs\ProvisionCustomerJob;
use App\Models\Customer;
use App\Models\User;
use App\Services\Hosting\Proxmox\ProxmoxClient;
use App\Services\Hosting\Snapshots\SnapshotService;
class ReinstallService
{
public function __construct(
private readonly ProxmoxClient $proxmox,
private readonly SnapshotService $snapshots,
) {}
public function reinstall(Customer $vm, User $user): void
{
if (! $vm->vmid) {
throw new \RuntimeException('VM ist nicht provisioniert.');
}
$this->snapshots->autoBeforeDestructive($vm, $user, 'reinstall');
$vmid = (int) $vm->vmid;
$this->proxmox->stopVM($vmid);
$this->proxmox->deleteVM($vmid);
$vm->update([
'status' => 'pending',
'provisioning_step' => 'queued',
'proxmox_status' => null,
'proxmox_uptime' => null,
'error_message' => null,
]);
ProvisionCustomerJob::dispatch($vm->id);
}
}