Hide Forgot
Created attachment 1192626 [details] test script Description of problem: Tried this code: https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/python-sdk-guide/#Example_Creating_a_Virtual_Machine_Storage_Disk_using_Python Version-Release number of selected component (if applicable): python-ovirt-engine-sdk4-4.0.0-0.5.a5.el7ev.x86_64 ovirt-engine-sdk-python-3.6.8.0-1.el7ev.noarch How reproducible: 100% Steps to Reproduce: 1. Try to add new disk to existing VM Actual results: Traceback (most recent call last): File "./createvm.py", line 62, in <module> d = sd.disks.add(disk_params) File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 25726, in add headers={"Correlation-Id":correlation_id, "Expect":expect} File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 79, in add return self.request('POST', url, body, headers, cls=cls) File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 122, in request persistent_auth=self.__persistent_auth File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 79, in do_request persistent_auth) File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 156, in __do_request raise errors.RequestError(response_code, response_reason, response_body) ovirtsdk.infrastructure.errors.RequestError: status: 400 reason: Bad Request detail: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <usage_message> <message>Request syntactically incorrect. See the description below for the correct usage:</message> <detailedLink href="/ovirt-engine/api/storagedomains/{storagedomain:id}/disks" rel="add"> <description>add a new disk to the storage domain</description> ... Expected results: Additional info:
Engine logs please?
Ondre, should someone from Storage look at it, or is this an issue with the SDK itself?
(In reply to Allon Mureinik from comment #2) > Ondre, should someone from Storage look at it, or is this an issue with the > SDK itself? Ondra, of course. My apologies for misspelling your name.
The import is not importing the v4 SDK: should be: import ovirtsdk4 as sdk while the snippet @ https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/python-sdk-guide/#Example_Creating_a_Virtual_Machine_Storage_Disk_using_Python shows: from ovirtsdk.api import API from ovirtsdk.xml import params So I assume it's using the v3 SDK. (if that's correct, then this should be moved to a Docs bug).
(In reply to Yaniv Kaul from comment #4) > The import is not importing the v4 SDK: > should be: > import ovirtsdk4 as sdk > > while the snippet @ > https://access.redhat.com/documentation/en/red-hat-virtualization/4.0/single/ > python-sdk-guide/ > #Example_Creating_a_Virtual_Machine_Storage_Disk_using_Python shows: > > from ovirtsdk.api import API > from ovirtsdk.xml import params > > So I assume it's using the v3 SDK. > > (if that's correct, then this should be moved to a Docs bug). It's correct. That's why I've opened this BZ against docs component
Created attachment 1192834 [details] engine log
Changing title accordingly...
This is Python SDK v3. The script in attachment is not what you have in traceback in bug description. I can see there : d = sd.disks.add(disk_params) Didn't you want to write something like `vm.disks.add(..)` ?
(In reply to Ondra Machacek from comment #8) > This is Python SDK v3. The script in attachment is not what you have in > traceback > in bug description. I can see there : > > d = sd.disks.add(disk_params) > > Didn't you want to write something like `vm.disks.add(..)` ? Right.Thanks. I messed up things during copy-pasting. Sorry about that. Closing
(In reply to Ondra Machacek from comment #8) > This is Python SDK v3. The script in attachment is not what you have in The docs link in comment 1 is for v4 API and does not contain the correct import statement, as indicated in comment 4 . Please fix.
As far as I know we don't have SDK v4 doc, yet. The link is for v3.
We don't have any v4 docs yet. This is planned for the first z stream.