Refactor VM resource specs resolution and enhance order payment success email with addon summary; add UpdateVmConfigJob for CPU/RAM updates

This commit is contained in:
baodev0
2026-07-17 14:00:42 +07:00
parent d9da3b5bb3
commit ad20cd5bdc
12 changed files with 458 additions and 33 deletions
+46
View File
@@ -36,6 +36,9 @@ final class VsphereHostSshService
private const SCRIPT_CHANGE_PWD_LINUX = 'changePwdLinux.ps1';
private const SCRIPT_CHANGE_PWD_WINDOWS = 'changePwdWindows.ps1';
private const ADDON_DIR = 'C:\\CLISave\\Addon';
private const SCRIPT_UPDATE_VM_CONFIG = 'updateVMConfig.ps1';
private const CONNECT_TIMEOUT = 20;
// ─────────────────────────────────────────────────────────────────────────
@@ -257,6 +260,49 @@ final class VsphereHostSshService
];
}
/**
* Update VM CPU and memory via updateVMConfig.ps1.
*
* Script path: C:\CLISave\Addon\updateVMConfig.ps1
* Params: $server_name $cpu $memoryGB $vcenter_host $vcenter_user $vcenter_password
* Output: "SUCCESS" or "FAIL"
*
* PS1 must call Connect-VIServer before Get-VM — see updateVMConfig.ps1 on vSphere host.
*/
public function updateVmConfig(
string $serverName,
int $cpu,
int $memoryGB,
string $vcenterHost,
string $vcenterUser,
string $vcenterPassword,
): string {
$remoteCmd = $this->windowsPowerShellCommand(self::ADDON_DIR, self::SCRIPT_UPDATE_VM_CONFIG, [
$serverName,
(string) $cpu,
(string) $memoryGB,
$vcenterHost,
$vcenterUser,
$vcenterPassword,
]);
Log::info('VsphereHostSshService: executing updateVmConfig', [
'server_name' => $serverName,
'cpu' => $cpu,
'memoryGB' => $memoryGB,
'vcenter_host' => $vcenterHost,
]);
$output = $this->sshExec($remoteCmd);
Log::info('VsphereHostSshService: updateVmConfig output', [
'server_name' => $serverName,
'output' => trim($output),
]);
return $output;
}
/**
* Customer-initiated VM password change.
*