- 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.
47 lines
998 B
PHP
47 lines
998 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\LogsActivity;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Support\Str;
|
|
|
|
class IpPool extends Model
|
|
{
|
|
use HasFactory, SoftDeletes, LogsActivity;
|
|
|
|
protected $fillable = [
|
|
'uuid',
|
|
'ip_address',
|
|
'gateway',
|
|
'cidr',
|
|
'netmask',
|
|
'module_network_id',
|
|
'status',
|
|
'service_id',
|
|
];
|
|
|
|
protected static function boot(): void
|
|
{
|
|
parent::boot();
|
|
|
|
static::creating(function (self $model) {
|
|
if (empty($model->uuid)) {
|
|
$model->uuid = (string) Str::uuid();
|
|
}
|
|
});
|
|
}
|
|
|
|
public function network()
|
|
{
|
|
return $this->belongsTo(ModuleNetwork::class, 'module_network_id', 'id');
|
|
}
|
|
|
|
public function virtualMachines()
|
|
{
|
|
return $this->hasMany(VirtualMachines::class, 'ip_pool_id');
|
|
}
|
|
}
|