feat: Enhance vCenter integration with resource pool and folder support
- Added methods to ResourceService for fetching resource pools and updated existing methods to include datacenter filtering. - Modified CreateVirtualMachine to accept folder and resource pool parameters from product data. - Updated various jobs to synchronize resource pools and include them in the provisioning process. - Introduced new ModuleResourcePool model and migration for resource pool management. - Enhanced existing models (ModuleDatastore, ModuleNetwork, Os) to include relationships with vCenter and resource pools. - Added netmask field to IpPool and updated related logic for IP reservation. - Improved error handling and logging in VM creation and IP reservation processes. - Updated API routes to include sync functionality for vCenter.
This commit is contained in:
@@ -100,8 +100,8 @@ class SyncDatastore implements ShouldQueue
|
||||
'vcenter_host_id' => $hostItem->host_id
|
||||
]);
|
||||
|
||||
// Use ResourceService to get datastores
|
||||
$datastore = $resourceService->loadDatastore($hostItem->host_id);
|
||||
// Use ResourceService to get datastores, scoped to this host AND datacenter
|
||||
$datastore = $resourceService->loadDatastore($hostItem->host_id, $_item->datacenter_id);
|
||||
|
||||
if ($datastore === "Login_Again") {
|
||||
$this->jobLog('Token expired → relogin');
|
||||
@@ -109,7 +109,7 @@ class SyncDatastore implements ShouldQueue
|
||||
|
||||
if ($token) {
|
||||
// Retry once
|
||||
$datastore = $resourceService->loadDatastore($hostItem->host_id);
|
||||
$datastore = $resourceService->loadDatastore($hostItem->host_id, $_item->datacenter_id);
|
||||
} else {
|
||||
$this->jobLog('Relogin failed');
|
||||
continue;
|
||||
@@ -135,6 +135,8 @@ class SyncDatastore implements ShouldQueue
|
||||
'name' => $_subItem['name'],
|
||||
'type' => $_subItem['type'],
|
||||
'space' => floor($_subItem['free_space'] / 1073741824),
|
||||
'vcenter_id' => $item->id,
|
||||
'status' => 1,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user