Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcpus are not represented as integers in Netbox #562

Closed
fabricat opened this issue Jul 22, 2021 · 3 comments
Closed

vcpus are not represented as integers in Netbox #562

fabricat opened this issue Jul 22, 2021 · 3 comments
Assignees

Comments

@fabricat
Copy link

ISSUE TYPE
  • Bug Report
SOFTWARE VERSIONS
Ansible:

ansible 2.9.19
python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

Netbox:

2.11.9

Collection:

3.1.1

SUMMARY

Every time I execute netbox_virtual_machine (with "state: present") on a VM already existing in Netbox, the item is alwasy marked as changed
Checking the diff, I see that the only difference is:

--- before
+++ after
@@ -1,3 +1,3 @@
 {
-    "vcpus": "2.00"
+    "vcpus": 2
 }

Indeed I notice that vCPU count in Netbox is now represented as a float number, also on the web UI.

Anyway, having a falsey "changed" status is annoying, since real changes are not evident.

STEPS TO REPRODUCE
- name: "Test Netbox vcpus issue"
  connection: local
  hosts: localhost
  gather_facts: False
  tasks:
    - name: Create a VM with 2 vCPU
      netbox_virtual_machine:
        netbox_url: http://netbox.local
        netbox_token: thisIsMyToken
        data:
          name: Test Virtual Machine
          cluster: test cluster
          vcpus: 2
        state: present

The first time, the VM is created.
If you run the same playbook once again (ansible-playbook -D test.yml), the VM is shown as changed (the only difference is the vcpus format).

EXPECTED RESULTS

The first time, the VM is created, thus the task result is changed.
The second time the task result should be ok.

ACTUAL RESULTS

The second time you run the playbook, the task result always appear as changed.

@ThomasADavis
Copy link
Contributor

This seems to be change in netbox v2.11 api itself - possibly to allow fractional CPU's?

ah found it.

netbox-community/netbox#5975

@rodvand rodvand self-assigned this Sep 25, 2021
@rodvand
Copy link
Contributor

rodvand commented Sep 25, 2021

I am unable to replicate the changed issue, but it's clear that the collection does not allow creation of the virtual machine with vcpu as a float for the moment. We should change the vcpu argument from int to float.

@bluikko
Copy link
Contributor

bluikko commented Oct 19, 2021

This is still not fixed - NetBox reports the vCPU with 2 decimals, so the VM is reported as changed on every run still:

--- before
+++ after
@@ -1 +1 @@
-vcpus: '4.00'
+vcpus: 4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants