<p dir="ltr">Writing a sensible test for this api is rather tricky, since it is intended to clean up one very specific error condition, and has few guarantees about the state it leaves the system in. It is provided as a tool to allow the system administrator to clean up certain faults and situations without needing to manually effort the database, however the conditions under which it is safe to use, and the cleanup actions that are required after calling it, vary between backends. </p>
<p dir="ltr">The only test I can think of that isĀ  probably safe across all backends is to call reserve, create_export, reset then delete. (All directly against the cinder endpoint with no Nova involvement).</p>
<p dir="ltr">There is a substantial danger in the thinking that this call is any sort of generic fixup - it will happily leave volumes attached behind the scenes, open to data corruption. </p>
<div class="gmail_extra"><br><div class="gmail_quote">On 18 Sep 2016 05:48, "joehuang" <<a href="mailto:joehuang@huawei.com">joehuang@huawei.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, Ken,<br>
<br>
Thank you for your information, for APIs without tempest test cases,<br>
it's due to hard to build the test environment, or it's just for the API<br>
is not mature enough? I want to know why the tempest test cases<br>
were not added at the same time when the features were implemented.<br>
<br>
Best Regards<br>
Chaoyi Huang(joehuang)<br>
______________________________<wbr>__________<br>
From: Ken'ichi Ohmichi [<a href="mailto:ken1ohmichi@gmail.com">ken1ohmichi@gmail.com</a>]<br>
Sent: 15 September 2016 2:02<br>
To: OpenStack Development Mailing List (not for usage questions)<br>
Subject: Re: [openstack-dev] [cinder]tempest test case for force detach volume<br>
<br>
Hi Chaoyi,<br>
<br>
That is a nice point.<br>
Now Tempest have tests for some volume v2 action APIs which doesn't<br>
contain os-force_detach.<br>
The available APIs of tempest are two: os-set_image_metadata and<br>
os-unset_image_metadata like<br>
<a href="https://github.com/openstack/tempest/blob/master/tempest/services/volume/v2/json/volumes_client.py#L27" rel="noreferrer" target="_blank">https://github.com/openstack/<wbr>tempest/blob/master/tempest/<wbr>services/volume/v2/json/<wbr>volumes_client.py#L27</a><br>
That is less than I expected by comparing the API reference.<br>
<br>
The corresponding API tests' patches are welcome if interested in :-)<br>
<br>
Thanks<br>
Ken Ohmichi<br>
<br>
---<br>
<br>
<br>
2016-09-13 17:58 GMT-07:00 joehuang <<a href="mailto:joehuang@huawei.com">joehuang@huawei.com</a>>:<br>
> Hello,<br>
><br>
> Is there ant tempest test case for "os-force_detach" action to force detach<br>
> a volume? I didn't find such a test case both in the repository<br>
> <a href="https://github.com/openstack/cinder/tree/master/cinder/tests/tempest" rel="noreferrer" target="_blank">https://github.com/openstack/<wbr>cinder/tree/master/cinder/<wbr>tests/tempest</a><br>
> and <a href="https://github.com/openstack/tempest" rel="noreferrer" target="_blank">https://github.com/openstack/<wbr>tempest</a><br>
><br>
> The API link is:<br>
> <a href="http://developer.openstack.org/api-ref-blockstorage-v2.html#forcedetachVolume" rel="noreferrer" target="_blank">http://developer.openstack.<wbr>org/api-ref-blockstorage-v2.<wbr>html#forcedetachVolume</a><br>
><br>
> Best Regards<br>
> Chaoyi Huang(joehuang)<br>
><br>
><br>
> ______________________________<wbr>______________________________<wbr>______________<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.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
><br>
<br>
______________________________<wbr>______________________________<wbr>______________<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.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
<br>
______________________________<wbr>______________________________<wbr>______________<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.<wbr>openstack.org?subject:<wbr>unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-dev</a><br>
</blockquote></div></div>