feat: Implement comprehensive vCenter integration with new services for VM configuration, power management, templates, snapshots, and resource management, alongside infrastructure management and synchronization job updates.

This commit is contained in:
pbao9
2026-02-12 17:23:01 +07:00
parent f3a679d7f3
commit 64c3182b00
16 changed files with 1979 additions and 223 deletions
+19 -24
View File
@@ -57,39 +57,34 @@ class SyncNetwork implements ShouldQueue
$dataCenter = ModuleDatacenter::where('vcenter_id', $item->id)->select('id', 'datacenter_id')->get();
foreach ($dataCenter as $_item) {
$allHost = ModuleHost::where('module_datacenter_id',$_item->id)->select('id','name')->get();
if ($allHost)
{
foreach ($allHost as $hostItem)
{
$allHost = ModuleHost::where('module_datacenter_id', $_item->id)
->select('id', 'name', 'host_id')
->get();
if ($allHost) {
foreach ($allHost as $hostItem) {
$network = $this->vCenter->loadNetWork($item,$hostItem->name);
$network = $this->vCenter->loadNetWork($item, $hostItem->host_id);
if ($network === "Login_Again") {
$token = $this->vCenter->loginServer($item);
if ($token)
{
vCenter::where('id',$item->id)->update(['token' => $token]);
if ($token) {
vCenter::where('id', $item->id)->update(['token' => $token]);
$this->vCenter->token = $token;
$network = $this->vCenter->loadNetWork($item,$hostItem->name);
$network = $this->vCenter->loadNetWork($item, $hostItem->host_id);
}
}
if ($network)
{
foreach ($network as $_subItem)
{
if (! ModuleNetwork::where('network',$_subItem['network'])->first())
{
ModuleNetwork::create([
'name' => $_subItem['name'],
if ($network) {
foreach ($network as $_subItem) {
ModuleNetwork::updateOrCreate(
[
'network' => $_subItem['network'],
'type' => $_subItem['type'],
'module_host_id' => $hostItem->id
]);
}
],
[
'name' => $_subItem['name'],
'type' => $_subItem['type'],
]
);
}
}
}