A library that seems to have a pretty nice abstraction for this kind of
thing/pattern, could be an idea to use it, or have something similar
like it...
https://boltons.readthedocs.org/en/latest/fileutils.html#atomic-file-saving
-Josh
On Sat, 26 Sep 2015 10:48:39 +0200
Julien Danjou
On 09/26/2015 02:48 AM, Julien Danjou wrote:
On Tue, Sep 22 2015, Chris Friesen wrote:
On 09/22/2015 05:48 PM, Joshua Harlow wrote:
A present:
>>> import contextlib
>>> import os
>>>
>>> @contextlib.contextmanager
... def synced_file(path, mode='wb'):
... with open(path, mode) as
On Tue, Sep 22 2015, Chris Friesen wrote:
> On 09/22/2015 05:48 PM, Joshua Harlow wrote:
>> A present:
>>
>> >>> import contextlib
>> >>> import os
>> >>>
>> >>> @contextlib.contextmanager
>> ... def synced_file(path, mode='wb'):
>> ... with open(path, mode) as fh:
>> ... yield fh
>>
On 09/24/2015 04:21 PM, Chris Friesen wrote:
On 09/24/2015 12:18 PM, Chris Friesen wrote:
I think what happened is that we took the SIGTERM after the open() call in
create_iscsi_target(), but before writing anything to the file.
f = open(volume_path, 'w+')
> -Original Message-
> From: Eric Harney [mailto:ehar...@redhat.com]
> Sent: Friday, September 25, 2015 2:56 PM
> To: OpenStack Development Mailing List (not for usage questions)
> Subject: Re: [openstack-dev] [cinder] should we use fsync when writing iscsi
> config f
> -Original Message-
> From: Chris Friesen [mailto:chris.frie...@windriver.com]
> Sent: Friday, September 25, 2015 3:04 PM
> To: openstack-dev@lists.openstack.org
> Subject: Re: [openstack-dev] [cinder] should we use fsync when writing iscsi
> config file?
>
>
On 09/25/2015 12:30 PM, Mitsuhiro Tanino wrote:
On 09/22/2015 06:43 PM, Robert Collins wrote:
On 23 September 2015 at 09:52, Chris Friesen
wrote:
Hi,
I recently had an issue with one file out of a dozen or so in
"/opt/cgcs/cinder/data/volumes/" being present but
gt; with proper authentication when c-vol is restarted.
> I think this is a solution for this situation.
>
This may be possible, but fixing the target config file to be written
more safely to work as currently intended is still a win.
> Any thought?
>
> Thanks,
> Mitsuhiro Tanino
ed.
I think this is a solution for this situation.
Any thought?
Thanks,
Mitsuhiro Tanino
> -Original Message-
> From: Chris Friesen [mailto:chris.frie...@windriver.com]
> Sent: Friday, September 25, 2015 12:48 PM
> To: openstack-dev@lists.openstack.org
> Subject: Re: [openstack-
On 09/24/2015 10:54 AM, Chris Friesen wrote:
I took another look at the code and realized that the file *should* get rebuilt
on restart after a power outage--if the file already exists it will print a
warning message in the logs but it should still overwrite the contents of the
file with the
On 09/24/2015 12:18 PM, Chris Friesen wrote:
I think what happened is that we took the SIGTERM after the open() call in
create_iscsi_target(), but before writing anything to the file.
f = open(volume_path, 'w+')
f.write(volume_conf)
f.close()
The 'w+' causes the
On 09/22/2015 06:19 PM, John Griffith wrote:
On Tue, Sep 22, 2015 at 6:17 PM, John Griffith
Hi,
I recently had an issue with one file out of a dozen or so in
"/opt/cgcs/cinder/data/volumes/" being present but of size zero. I'm running
stable/kilo if it makes a difference.
Looking at the code in volume.targets.tgt.TgtAdm.create_iscsi_target(), I'm
wondering if we should do a
Chris Friesen wrote:
On 09/22/2015 05:48 PM, Joshua Harlow wrote:
A present:
>>> import contextlib
>>> import os
>>>
>>> @contextlib.contextmanager
... def synced_file(path, mode='wb'):
... with open(path, mode) as fh:
... yield fh
... os.fdatasync(fh.fileno())
...
>>> with
On Tue, Sep 22, 2015 at 6:17 PM, John Griffith
wrote:
>
>
> On Tue, Sep 22, 2015 at 5:48 PM, Joshua Harlow
> wrote:
>
>> A present:
>>
>> >>> import contextlib
>> >>> import os
>> >>>
>> >>> @contextlib.contextmanager
>> ... def synced_file(path,
A present:
>>> import contextlib
>>> import os
>>>
>>> @contextlib.contextmanager
... def synced_file(path, mode='wb'):
... with open(path, mode) as fh:
... yield fh
... os.fdatasync(fh.fileno())
...
>>> with synced_file("/tmp/b.txt") as fh:
...fh.write("b")
...
Have fun :-P
On 09/22/2015 05:48 PM, Joshua Harlow wrote:
A present:
>>> import contextlib
>>> import os
>>>
>>> @contextlib.contextmanager
... def synced_file(path, mode='wb'):
... with open(path, mode) as fh:
... yield fh
... os.fdatasync(fh.fileno())
...
>>> with
On 23 September 2015 at 09:52, Chris Friesen
wrote:
> Hi,
>
> I recently had an issue with one file out of a dozen or so in
> "/opt/cgcs/cinder/data/volumes/" being present but of size zero. I'm
> running stable/kilo if it makes a difference.
>
> Looking at the code
On Tue, Sep 22, 2015 at 5:48 PM, Joshua Harlow wrote:
> A present:
>
> >>> import contextlib
> >>> import os
> >>>
> >>> @contextlib.contextmanager
> ... def synced_file(path, mode='wb'):
> ... with open(path, mode) as fh:
> ... yield fh
> ...
19 matches
Mail list logo