Configuration Locked

Eric Brunson brunson at brunson.com
Mon Feb 6 14:55:50 PST 2006


Gustavo Niemeyer wrote:
>> I had to kill a hung smart process and now my configuration is locked.
>> I've found the "--ignore-locks" option, but I haven't found an option
>> to remove the lock.  Is there any solution other than writing my own
>> python script that opens the config, releases the lock and writes it
>> back?
>>     
>
> Smart uses fcntl locking, which means that the only way to achieve
> a locked Smart is with a running process. You don't have to remove
> any lock files, just kill the process and you're done. If it's still
> locked, look closer, there's still a running process.
>   
Then what does this code do?

class SysConfig(object):

    def __init__(self, root=()):
        self._readonly = False

    def getReadOnly(self):
        return self._readonly

    def setReadOnly(self, flag):
        self._readonly = flag

    def assertWritable(self):
        if self._readonly:
            raise Error, _("Configuration is in readonly mode.")

After killing a hung smart session I had to write a script to open the 
config, change it back to False and write it back out before I could use 
smart without the --ignorelocks option.  And that was after a reboot, so 
I don't think there were other processes still running.

>   
>> This is exactly the kind of inelegance I was alluding to in my previous 
>> email questioning the rationale of having a pickled config.
>>     
>
> Your problem has absolutely nothing to do with pickled
> configuration files.
>   
I think you're confusing my problem with the PathLocks functionality, 
which does use fcntl.





More information about the Smart mailing list