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

How to add a disk to already created VM? #77

Open
gauravkanojia opened this issue Jun 7, 2019 · 0 comments
Open

How to add a disk to already created VM? #77

gauravkanojia opened this issue Jun 7, 2019 · 0 comments

Comments

@gauravkanojia
Copy link

gauravkanojia commented Jun 7, 2019

Hi there folks, I'm facing issues when trying to add a new additional hard disk to an already created VM. I browsed through https://pve.proxmox.com/pve-docs/api-viewer/ and understood the structure but getting 501 Not Implemented: {"data":null}
Here is my code:

vmIds = array('i', [208])

headIds = array('i', [3302])

vmIdIdx = 0

for HEAD in headIds:
    vmId = vmIds[vmIdIdx]
    headId = 'proxmox-' + str(HEAD)
    print('proxmox-node -->' + headId, ' | VMID -->' + str(vmId))

    qemu_node = proxmox.nodes(headId)
    vm_config_old = qemu_node.qemu(vmIds[vmIdIdx]).config.get()
    print('Host details before adding disk')
    pp.pprint(vm_config_old)

#     pp.pprint(qemu_node.storage.get(storage='xxx-xxxx-vol-xx1')) # This line prints fine
    qemu_node.storage.content.create(filename='var/lib/docker-config',
                                     vmid=vmId, node=headId,
                                     storage='xxx-xxxx-vol-xx1', size='32767M', format='qcow2')
    vm_config_new = qemu_node.qemu(vmIds[vmIdIdx]).config.get()
    print('Host details after adding disk')
    pp.pprint(vm_config_new)
    vmIdIdx = vmIdIdx + 1

Here is the error:

Traceback (most recent call last):
  File "add_disk_to_tr1_vm.py", line 47, in <module>
    storage='netapp-prod-vol-ds1', size='32767M', format='qcow2')
  File "/usr/local/lib/python2.7/site-packages/proxmoxer/core.py", line 96, in create
    return self.post(*args, **data)
  File "/usr/local/lib/python2.7/site-packages/proxmoxer/core.py", line 87, in post
    return self(args)._request("POST", data=data)
  File "/usr/local/lib/python2.7/site-packages/proxmoxer/core.py", line 79, in _request
    resp.content))
proxmoxer.core.ResourceException: 501 Not Implemented: {"data":null}

Any pointers will be helpful.
Thanks.

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

No branches or pull requests

1 participant