mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #8222: Enable the assignment of a VM to a specific host device within a cluster
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from dcim.choices import InterfaceModeChoices
|
||||
from dcim.models import DeviceRole, Platform, Site
|
||||
from dcim.models import Device, DeviceRole, Platform, Site
|
||||
from ipam.models import VRF
|
||||
from netbox.forms import NetBoxModelCSVForm
|
||||
from tenancy.models import Tenant
|
||||
@ -76,6 +76,12 @@ class VirtualMachineCSVForm(NetBoxModelCSVForm):
|
||||
to_field_name='name',
|
||||
help_text='Assigned cluster'
|
||||
)
|
||||
device = CSVModelChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
to_field_name='name',
|
||||
required=False,
|
||||
help_text='Assigned device within cluster'
|
||||
)
|
||||
role = CSVModelChoiceField(
|
||||
queryset=DeviceRole.objects.filter(
|
||||
vm_role=True
|
||||
@ -100,7 +106,7 @@ class VirtualMachineCSVForm(NetBoxModelCSVForm):
|
||||
class Meta:
|
||||
model = VirtualMachine
|
||||
fields = (
|
||||
'name', 'status', 'role', 'cluster', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'comments',
|
||||
'name', 'status', 'role', 'cluster', 'device', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'comments',
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user