mirror of
https://github.com/bb-Ricardo/netbox-sync.git
synced 2026-01-29 04:19:10 -06:00
Merge pull request #435 from joachimBurket/feat/set-vm-serial-number-from-instanceuuid
Add the `serial` field to NetBox VirtualMachine
This commit is contained in:
@@ -1645,6 +1645,7 @@ class NBVM(NetBoxObject):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.data_model = {
|
||||
"name": 64,
|
||||
"serial": 50,
|
||||
"status": ["offline", "active", "planned", "staged", "failed", "decommissioning"],
|
||||
"cluster": NBCluster,
|
||||
"role": NBDeviceRole,
|
||||
|
||||
@@ -2197,6 +2197,10 @@ class VMWareHandler(SourceBase):
|
||||
if isinstance(comp, vim.vm.device.VirtualDisk)
|
||||
]) / 1024 / 1024)
|
||||
|
||||
# Add adaptation for the new 'serial' field in NetBox 4.1.0 VM model
|
||||
if version.parse(self.inventory.netbox_api_version) >= version.parse("4.1.0"):
|
||||
vm_data["serial"] = vm_uuid
|
||||
|
||||
if platform is not None:
|
||||
vm_data["platform"] = {"name": platform}
|
||||
if annotation is not None:
|
||||
|
||||
Reference in New Issue
Block a user