Skip to content

Commit 157ce15

Browse files
authored
Fix #562 Change vCPU on Virtual Machine to float (#605)
* Change vcpu on Virtual Machine from int to float * Update test to include test for fractional vCPU in 2.11
1 parent 3c1c458 commit 157ce15

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

plugins/modules/netbox_virtual_machine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
description:
7373
- Number of vcpus of the virtual machine
7474
required: false
75-
type: int
75+
type: float
7676
tenant:
7777
description:
7878
- The tenant that the virtual machine will be assigned to
@@ -236,7 +236,7 @@ def main():
236236
site=dict(required=False, type="raw"),
237237
cluster=dict(required=False, type="raw"),
238238
virtual_machine_role=dict(required=False, type="raw"),
239-
vcpus=dict(required=False, type="int"),
239+
vcpus=dict(required=False, type="float"),
240240
tenant=dict(required=False, type="raw"),
241241
platform=dict(required=False, type="raw"),
242242
primary_ip4=dict(required=False, type="raw"),

tests/integration/targets/v2.11/tasks/netbox_virtual_machine.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
data:
5050
name: "Test VM One"
5151
cluster: "Test Cluster"
52-
vcpus: 8
52+
vcpus: 8.5
5353
memory: 8
5454
status: "Planned"
5555
virtual_machine_role: "Test VM Role"
@@ -62,14 +62,14 @@
6262
assert:
6363
that:
6464
- test_three is changed
65-
- test_three['diff']['after']['vcpus'] == 8
65+
- test_three['diff']['after']['vcpus'] == 8.5
6666
- test_three['diff']['after']['memory'] == 8
6767
- test_three['diff']['after']['status'] == "planned"
6868
- test_three['diff']['after']['role'] == 2
6969
- test_three['diff']['after']['tags'][0] == 4
7070
- test_three['virtual_machine']['name'] == "Test VM One"
7171
- test_three['virtual_machine']['cluster'] == 1
72-
- test_three['virtual_machine']['vcpus'] == 8
72+
- test_three['virtual_machine']['vcpus'] == 8.5
7373
- test_three['virtual_machine']['memory'] == 8
7474
- test_three['virtual_machine']['status'] == "planned"
7575
- test_three['virtual_machine']['role'] == 2
@@ -91,7 +91,7 @@
9191
- test_four is changed
9292
- test_four['virtual_machine']['name'] == "Test VM One"
9393
- test_four['virtual_machine']['cluster'] == 1
94-
- test_four['virtual_machine']['vcpus'] == "8.00"
94+
- test_four['virtual_machine']['vcpus'] == "8.50"
9595
- test_four['virtual_machine']['memory'] == 8
9696
- test_four['virtual_machine']['status'] == "planned"
9797
- test_four['virtual_machine']['role'] == 2

tests/integration/targets/v3.0/tasks/netbox_virtual_machine.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
data:
5050
name: "Test VM One"
5151
cluster: "Test Cluster"
52-
vcpus: 8
52+
vcpus: 8.5
5353
memory: 8
5454
status: "Planned"
5555
virtual_machine_role: "Test VM Role"
@@ -62,7 +62,7 @@
6262
assert:
6363
that:
6464
- test_three is changed
65-
- test_three['diff']['after']['vcpus'] == 8
65+
- test_three['diff']['after']['vcpus'] == 8.5
6666
- test_three['diff']['after']['memory'] == 8
6767
- test_three['diff']['after']['status'] == "planned"
6868
- test_three['diff']['after']['role'] == 2
@@ -91,7 +91,7 @@
9191
- test_four is changed
9292
- test_four['virtual_machine']['name'] == "Test VM One"
9393
- test_four['virtual_machine']['cluster'] == 1
94-
- test_four['virtual_machine']['vcpus'] == "8.00"
94+
- test_four['virtual_machine']['vcpus'] == 8.5
9595
- test_four['virtual_machine']['memory'] == 8
9696
- test_four['virtual_machine']['status'] == "planned"
9797
- test_four['virtual_machine']['role'] == 2

0 commit comments

Comments
 (0)