Bug 862027 - Unable to attach to vm disk which was created separately via SDK
Summary: Unable to attach to vm disk which was created separately via SDK
Keywords:
Status: CLOSED DUPLICATE of bug 854479
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-sdk
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Michael Pasternak
QA Contact: Oded Ramraz
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-01 16:10 UTC by Ondra Machacek
Modified: 2014-01-13 00:38 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-10-02 09:09:22 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine.log (5.35 KB, text/x-log)
2012-10-02 07:11 UTC, Ondra Machacek
no flags Details
sdk log (6.07 KB, text/plain)
2012-10-02 07:30 UTC, Ondra Machacek
no flags Details

Description Ondra Machacek 2012-10-01 16:10:19 UTC
Description of problem:
When I create a disk. Than I can't attach it to vm.

Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. Try to run code below.
  
Actual results:
Traceback (most recent call last):
  File "./test.py", line 64, in <module>
    API.vms.get('a').disks.add(disk=d)
  File "/usr/lib/python2.7/site-packages/ovirt_engine_sdk-3.2.0.2_SNAPSHOT-py2.7.egg/ovirtsdk/infrastructure/brokers.py", line 5653, in add
    return VMDisk(self.parentclass, result)
  File "/usr/lib/python2.7/site-packages/ovirt_engine_sdk-3.2.0.2_SNAPSHOT-py2.7.egg/ovirtsdk/infrastructure/brokers.py", line 5459, in __init__
    self.parentclass = vm
  File "/usr/lib/python2.7/site-packages/ovirt_engine_sdk-3.2.0.2_SNAPSHOT-py2.7.egg/ovirtsdk/xml/params.py", line 186, in __setattr__
    object.__setattr__(self.superclass, item, value.superclass)
AttributeError: 'str' object has no attribute 'parentclass'

Expected results:
Disk successfully attached.

Additional info:

code:

param = params.StorageDomains(storage_domain=[API.storagedomains.get('SD')])
d = params.Disk(interface='virtio', format='cow', provisioned_size=1024*1024, storage_domains=param)
d = API.disks.add(d)
API.vms.get('a').disks.add(disk=d)

Comment 1 Michael Pasternak 2012-10-01 21:15:48 UTC
Ondra,

please attach:

1. engine log
2. sdk log
3. what api/engine version you're using?
4. what sdk version you're using?

* always include this info when you file a bug.

i'm 99% sure that there is no bug in sdk, just in API.disks.add(d) returned
no disk in response (from api) as in #854479

Comment 2 Ondra Machacek 2012-10-02 07:11:47 UTC
Created attachment 620158 [details]
engine.log

Comment 3 Ondra Machacek 2012-10-02 07:30:23 UTC
Created attachment 620168 [details]
sdk log

3. si19.1
4. ovirt_engine_sdk - 3.2.0.2

As a response for:

curl -k -X POST -H "Accept: application/xml" -H "Content-Type: application/xml" \
    -u $ADMIN -d "<disk> <storage_domains> <storage_domain href=\"/api/storagedomains/76af455c-9287-4d70-b5d7-dac8d516ef01\" id=\"76af455c-9287-4d70-b5d7-dac8d516ef01\"><name>om01</name><link href=\"/api/storagedomains/76af455c-9287-4d70-b5d7-dac8d516ef01/permissions\" rel=\"permissions\"/><type>data</type><master>true</master><storage><type>nfs</type><address>10.34.63.199</address><path>/om01</path></storage><available>106300440576</available><used>0</used><committed>0</committed><storage_format>v3</storage_format></storage_domain></storage_domains><provisioned_size>1048576</provisioned_size><interface>virtio</interface><format>cow</format></disk>" \
    https://10.34.63.30:443/api/disks

i get this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<disk href="/api/disks/aa598f8c-fb0b-4fe8-b839-69d0e3be72f4" id="aa598f8c-fb0b-4fe8-b839-69d0e3be72f4">
    <name>_Disk1</name>
    <creation_status>
        <state>pending</state>
    </creation_status>
    <link href="/api/disks/aa598f8c-fb0b-4fe8-b839-69d0e3be72f4/statistics" rel="statistics"/>
    <link href="/api/disks/aa598f8c-fb0b-4fe8-b839-69d0e3be72f4/creation_status/155a878c-df96-472f-b4da-4f560105a429" rel="creation_status"/>
    <image_id>329cbea6-d3fd-4a06-a58e-0b2f5f80f6e0</image_id>
    <storage_domains>
        <storage_domain id="76af455c-9287-4d70-b5d7-dac8d516ef01"/>
    </storage_domains>
    <size>1048576</size>
    <provisioned_size>1048576</provisioned_size>
    <actual_size>0</actual_size>
    <status>
        <state>locked</state>
    </status>
    <interface>virtio</interface>
    <format>cow</format>
    <sparse>true</sparse>
    <bootable>false</bootable>
    <shareable>false</shareable>
    <wipe_after_delete>false</wipe_after_delete>
    <propagate_errors>false</propagate_errors>
    <quota id="00000000-0000-0000-0000-000000000000"/>
</disk>

Comment 4 Michael Pasternak 2012-10-02 08:16:57 UTC
(In reply to comment #3)
> Created attachment 620168 [details]
> sdk log
> 
> 3. si19.1
> 4. ovirt_engine_sdk - 3.2.0.2
> 
> As a response for:
> 
> curl -k -X POST -H "Accept: application/xml" -H "Content-Type:
> application/xml" \
>     -u $ADMIN -d "<disk> <storage_domains> <storage_domain
> href=\"/api/storagedomains/76af455c-9287-4d70-b5d7-dac8d516ef01\"
> id=\"76af455c-9287-4d70-b5d7-dac8d516ef01\"><name>om01</name><link
> href=\"/api/storagedomains/76af455c-9287-4d70-b5d7-dac8d516ef01/
> permissions\"
> rel=\"permissions\"/><type>data</type><master>true</
> master><storage><type>nfs</type><address>10.34.63.199</address><path>/om01</
> path></storage><available>106300440576</available><used>0</
> used><committed>0</committed><storage_format>v3</storage_format></
> storage_domain></storage_domains><provisioned_size>1048576</
> provisioned_size><interface>virtio</interface><format>cow</format></disk>" \
>     https://10.34.63.30:443/api/disks
> 

this is creation of disk at /api/disks/, which is worked for you as well,
please attach sdk logs for the 'attach' of disk to vm.

Comment 5 Ondra Machacek 2012-10-02 09:09:22 UTC
Yes, i got as a response empty string:

send: 'POST /api/vms/bfabffca-87e5-40ed-962f-bfebacb8598c/disks HTTP/1.1\r\nHost: 10.34.63.30\r\nAccept-Encoding: identity\r\nContent-Length: 1088\r\nFilter: False\r\ncookie: JSESSIONID=hwpneupseUHHN6qwDhYZSbdu\r\nPrefer: persistent-auth\r\nContent-type: application/xml\r\nAuthorization: Basic YWRtaW5AaW50ZXJuYWw6MTIzNDU2\r\n\r\n<disk href="/api/disks/ed932fd2-d435-48ad-b0dd-5511a00dddfe" id="ed932fd2-d435-48ad-b0dd-5511a00dddfe">\n    <name>_Disk1</name>\n    <creation_status>\n        <state>pending</state>\n    </creation_status>\n    <link href="/api/disks/ed932fd2-d435-48ad-b0dd-5511a00dddfe/statistics" rel="statistics"/>\n    <link href="/api/disks/ed932fd2-d435-48ad-b0dd-5511a00dddfe/creation_status/2fcc79ae-29bf-40d6-9b90-5ecd7d5828c4" rel="creation_status"/>\n    <image_id>30e3c403-29ee-4b0f-b373-8e694292a760</image_id>\n    <storage_domains>\n        <storage_domain id="76af455c-9287-4d70-b5d7-dac8d516ef01"/>\n    </storage_domains>\n    <size>1048576</size>\n    <provisioned_size>1048576</provisioned_size>\n    <actual_size>0</actual_size>\n    <status>\n        <state>locked</state>\n    </status>\n    <interface>virtio</interface>\n    <format>cow</format>\n    <sparse>true</sparse>\n    <bootable>false</bootable>\n    <shareable>false</shareable>\n    <wipe_after_delete>false</wipe_after_delete>\n    <propagate_errors>false</propagate_errors>\n    <quota id="00000000-0000-0000-0000-000000000000"/>\n</disk>\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Tue, 02 Oct 2012 09:06:35 GMT
header: Content-Length: 0
header: Connection: close
header: Content-Type: text/plain; charset=UTF-8


So i'll close it as duplicate.

*** This bug has been marked as a duplicate of bug 854479 ***


Note You need to log in before you can comment on or make changes to this bug.