argument('vm_id'); $cpuAddon = (int) $this->option('cpu'); $ramAddon = (int) $this->option('ram'); $diskAddon = (int) $this->option('disk'); $vcenterId = (int) $this->option('vcenter'); $this->info("🧪 Testing addon update for VM: {$vmId}"); $this->info("Addon config: CPU={$cpuAddon}, RAM={$ramAddon}GB, Disk={$diskAddon}GB"); try { // Lấy vCenter model $vcenterModel = VcenterModel::find($vcenterId); if (!$vcenterModel) { $this->error("❌ Không tìm thấy vCenter với ID: {$vcenterId}"); return 1; } $this->info("📡 Connecting to vCenter: {$vcenterModel->host}"); // Khởi tạo vCenter service $vCenter = new vCenter(); // Login to vCenter if (!$vCenter->loginServer($vcenterModel)) { $this->error("❌ Không thể login vào vCenter"); return 1; } $this->info("✅ Login thành công"); // Test addon update $addon = [ 'cpu' => $cpuAddon, 'ram' => $ramAddon, 'disk' => $diskAddon ]; $result = $vCenter->testAddonUpdate($vmId, $addon, 1, 1); if ($result['error']) { $this->error("❌ Test thất bại: " . $result['message']); return 1; } $this->info("✅ Test thành công: " . $result['message']); $this->info("📋 Kiểm tra logs để xem chi tiết"); return 0; } catch (\Exception $e) { $this->error("❌ Exception: " . $e->getMessage()); Log::error("TestAddonUpdate command error: " . $e->getMessage()); return 1; } } }