<div dir="ltr"><div>Try client.volumes..get(id).__dict__['<span><b>os-vol-host-attr:host'] <br><br></b></span></div><span><b>Ugly, but it seems to work<br></b></span></div><div class="gmail_extra"><br><div class="gmail_quote">On 6 January 2016 at 18:20, Pradip Mukhopadhyay <span dir="ltr"><<a href="mailto:pradip.interra@gmail.com" target="_blank">pradip.interra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Thanks, Yuriy.<br><br></div>My question was: how can I retrieve the "<span>host@backend#pool" from the pythonclient API of volume listing? Once I have that, I should use this method to extract the pool-name.<br><br></span></div><div><span>But how can I access this info? CLI is showing this as in the following field:<br><br>stack@openstack4:~/devstack$ cinder show e8be1df5-64fb-43fa-aacd-9bebba17fba5<br>+---------------------------------------+--------------------------------------+<br>|                Property               |                Value                 |<br>+---------------------------------------+--------------------------------------+<br>|              attachments              |                  []                  |<br>|           availability_zone           |                 nova                 |<br>|                bootable               |                false                 |<br>|          consistencygroup_id          |                 None                 |<br>|               created_at              |      2016-01-06T14:21:32.000000      |<br>|              description              |                 None                 |<br>|               encrypted               |                False                 |<br>|                   id                  | e8be1df5-64fb-43fa-aacd-9bebba17fba5 |<br>|                metadata               |                  {}                  |<br>|            migration_status           |                 None                 |<br>|              multiattach              |                False                 |<br>|                  name                 |                 None                 |<br>|         <b>os-vol-host-attr:host         |  openstack4@SCSIBackend#pool1</b>   |<br>|     os-vol-mig-status-attr:migstat    |                 None                 |<br>|     os-vol-mig-status-attr:name_id    |                 None                 |<br>|      os-vol-tenant-attr:tenant_id     |   4713f79411844a29b3f53d5fd7502784   |<br>|   os-volume-replication:driver_data   |                 None                 |<br>| os-volume-replication:extended_status |                 None                 |<br>|           replication_status          |               disabled               |<br>|                  size                 |                  1                   |<br>|              snapshot_id              |                 None                 |<br>|              source_volid             |                 None                 |<br>|                 status                |              available               |<br>|               updated_at              |      2016-01-06T14:21:34.000000      |<br>|                user_id                |   89b4af10bc1a473caff22384c844bc6f   |<br>|              volume_type              |               iscsi_1                |<br>+---------------------------------------+--------------------------------------+<br><br><br><br></span></div><div><span>Now in python client API, I am not able to get that field :(<br><br><br></span><span class=""><br>

<p class="MsoNormal">>>> volumes = cinder.volumes.list()</p>

<p class="MsoNormal">>>> volumes</p>

<p class="MsoNormal">[<Volume: e8be1df5-64fb-43fa-aacd-9bebba17fba5>]</p></span><p class="MsoNormal">>>> type(volumes[0])<br><class 'cinderclient.v2.volumes.Volume'><br></p><span class="">

<p class="MsoNormal">>>> volumes[0].id</p>

<p class="MsoNormal">u'e8be1df5-64fb-43fa-aacd-9bebba17fba5'</p></span><p class="MsoNormal">>>> volumes[0].host<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>  File "/usr/local/lib/python2.7/dist-packages/cinderclient/openstack/common/apiclient/base.py", line 464, in __getattr__<br>    raise AttributeError(k)<br>AttributeError: host<br>>>> volumes[0].os-vol-host-attr<br>Traceback (most recent call last):<br>  File "<stdin>", line 1, in <module><br>  File "/usr/local/lib/python2.7/dist-packages/cinderclient/openstack/common/apiclient/base.py", line 464, in __getattr__<br>    raise AttributeError(k)<br>AttributeError: os<br></p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal">Essentially what is the way to get the attribute from the API?</p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal">Thanks,</p><p class="MsoNormal">Pradip</p><p class="MsoNormal"><br></p>

</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 9:28 PM, Yuriy Nesenenko <span dir="ltr"><<a href="mailto:ynesenenko@mirantis.com" target="_blank">ynesenenko@mirantis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry, of course this <a href="https://github.com/openstack/cinder/blob/master/cinder/volume/utils.py#L575" target="_blank">https://github.com/openstack/cinder/blob/master/cinder/volume/utils.py#L575</a><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 6, 2016 at 5:57 PM, Yuriy Nesenenko <span dir="ltr"><<a href="mailto:ynesenenko@mirantis.com" target="_blank">ynesenenko@mirantis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You can use this function <br><a href="https://github.com/openstack/cinder/blob/master/cinder/volume/utils.py#L5" target="_blank">https://github.com/openstack/cinder/blob/master/cinder/volume/utils.py#L5</a><span></span><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Wed, Jan 6, 2016 at 5:44 PM, Pradip Mukhopadhyay <span dir="ltr"><<a href="mailto:pradip.interra@gmail.com" target="_blank">pradip.interra@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div>Hello,<br><br><br></div>From CLI, I can see the host-name in the cinder show command as follows:<br><br>|         os-vol-host-attr:host         |  openstack4@mySCSIBackend#pool1   |<br><br></div>How this info can be accessed from the cinder python client?<br><br></div>I can access other information (id, size, name etc.) as follows:<br><br>

<p class="MsoNormal">>>> volumes = cinder.volumes.list()</p>

<p class="MsoNormal">>>> volumes</p>

<p class="MsoNormal">[<Volume: e8be1df5-64fb-43fa-aacd-9bebba17fba5>]</p>

<p class="MsoNormal">>>> volumes[0].id</p>

<p class="MsoNormal">u'e8be1df5-64fb-43fa-aacd-9bebba17fba5'</p>

<p class="MsoNormal">>>> volumes[0].volume_type</p>

<p class="MsoNormal">u'iscsi_1'</p>

<br><br></div><br></div>Thanks,<br></div>Pradip<br><br><br><div><div><div><div><div><span style="font-size:11pt;font-family:"Calibri","sans-serif";color:red"><span></span></span></div></div></div></div></div></div>
<br></div></div>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div><br>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>
</div></div><br>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>-- <br>Duncan Thomas</div></div></div>
</div>