<div dir="ltr">resendign it with correct cinder prefix in subject.<br><br>thanx,<br>deepak<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 3, 2014 at 7:44 PM, Deepak Shetty <span dir="ltr"><<a href="mailto:dpkshetty@gmail.com" target="_blank">dpkshetty@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"><br><tt>Hi</tt><tt>,</tt><tt><br>
</tt><tt> I am looking to umount the glsuterfs shares that are mounted as part of gl</tt><tt>uster driver, when c-vol is being restarted or Ctrl-C'ed (as in devstack env) or when c-vol service is being shut</tt><tt>down.</tt><tt><br>
</tt><tt><br>
</tt><tt>I tried to use __del__ in </tt><tt>GlusterfsDriver(nfs.RemoteFsDriver) and it didn't work</tt><tt><br>
</tt><tt><br>
</tt>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>def __del__(self):</tt></div>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt> LOG.info(_("DPKS: Inside __del__ Hurray!, shares=%s")% self._mounted_shares)</tt></div>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt> for share in self._mounted_shares:</tt></div>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt> mount_path = self._get_mount_point_for_share(share)</tt></div>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt> command = ['umount', mount_path]</tt></div>
<div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt> self._do_umount(command, True, share)</tt></div>
<p><tt>self._mounted_shares is defined in the base class (RemoteFsDriver)</tt><tt><br>
</tt></p>
<ol><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>^C2014-04-03 13:29:55.547 INFO cinder.openstack.common.service [-] Caught SIGINT, stopping children</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>2014-04-03 13:29:55.548 INFO cinder.openstack.common.service [-] Caught SIGTERM, exiting</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>2014-04-03 13:29:55.550 INFO cinder.openstack.common.service [-] Caught SIGTERM, exiting</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>2014-04-03 13:29:55.560 INFO cinder.openstack.common.service [-] Waiting on 2 children to exit</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>2014-04-03 13:29:55.561 INFO cinder.openstack.common.service [-] Child 30185 exited with status 1</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>2014-04-03 13:29:55.562 INFO cinder.volume.drivers.glusterfs [-] DPKS: Inside __del__ Hurray!, shares=[]</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>2014-04-03 13:29:55.563 INFO cinder.openstack.common.service [-] Child 30186 exited with status 1</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>Exception
TypeError: "'NoneType' object is not callable" in <bound method
GlusterfsDriver.__del__ of
<cinder.volume.drivers.glusterfs.GlusterfsDriver object at
0x2777ed0>> ignored</tt></div></li><li><div style="font-style:normal;font-variant:normal;font-weight:normal;font-size:1em;line-height:1.2em;font-size-adjust:none;font-stretch:normal;margin:0px;padding:0px;background:none repeat scroll 0% 0% transparent;vertical-align:top">
<tt>[stack@devstack-vm tempest]$ </tt></div></li></ol>
<p><tt>So the _mounted_shares is empty ([]) which isn't true since I
have 2 glsuterfs shares mounted and when i print _mounted_shares in
other parts of code, it does show me the right thing.. as below...</tt><tt><br>
</tt></p>
<p><tt>From volume/drivers/glusterfs.py @ line 1062:</tt><tt><br>
</tt><tt> LOG.debug(_('Available shares: %s') % self._mounted_shares)</tt><tt><br>
</tt></p>
<p><tt>which dumps the debugprint as below...</tt><tt><br>
</tt></p>
<p><tt>2014-04-03 13:29:45.414 DEBUG cinder.volume.drivers.glusterfs [req-2cf69316-cc42-403a-96f1-90e8e77375aa None None]</tt><tt><b> Available shares: [u'devstack-vm.localdomain:/gvol1', u'devstack-vm.localdomain:/gvol1']</b></tt><tt> from (pid=30185) _ensure_shares_mounted /opt/stack/cinder/cinder/volume/drivers/glusterfs.py:1061</tt><tt><br>
</tt></p>
<tt>This brings in few Qs ( I am usign devstack env) ...</tt><tt><br>
</tt><tt><br>
</tt><tt>1) Is __del__ the right way to do cleanup for a cinder driver ? I have 2 gluster backends setup, hence 2 cinder-volume instances, but i see __del__ being called once only (as per above debug prints)</tt><tt><br>
</tt><tt>2) I tried atexit and registering a function to do the cleanup.
Ctrl-C'ing c-vol (from screen ) gives the same issue.. shares is empty
([]), but this time i see that my atexit handler called twice (once for
each backend)</tt><tt><br>
</tt><tt>3) In general, whats the right way to do cleanup inside cinder volume driver when a service is going down or being restarted ?<br>
4) The solution should work in both devstack (ctrl-c to shutdown c-vol service) and production (where we do service restart c-vol)<br>
<br>
Would appreciate a response<br>
<br>
thanx,<br>
deepak<br>
<br>
</tt></div>
</blockquote></div><br></div></div>