Ceph dmcrypt with LUKS (split into 4 patches)

Updated patch series splits the same resulting patch into parts that may be easier to understand and merge (eg, not changing the default during a release series).

No tests at this point, but I will add these soon and update again.
On Fri, 2014-12-05 at 01:53 -0800, Loic Dachary wrote:
> In src/ceph-disk:
> 
> > +        try:
> > +            with file('/dev/urandom', 'rb') as i:
> > +                key = i.read(key_size / 8)
> > +        except IOError:
> > +            raise Error('unable to read %d bytes of random data' % key_size / 8)
> > +
> > +        try:
> > +            fd = os.open(path, os.O_WRONLY | os.O_CREAT, stat.S_IRUSR + stat.S_IWUSR)
> > +        except IOError:
> > +            raise Error('unable to create dm-crypt key', path)
> > +
> > +        try:
> > +            key_file = os.fdopen(fd, 'w')
> > +        except IOError:
> > +            os.close(fd)
> > +            raise Error('unable to open dm-crypt key', path)
> 
> I'm curious about what this try block covers. fd already is a file
> descriptor to that can be used to write in the file, right ?

That one is indeed pretty useless - I got frustrated with trying to work
out which bit failed, so split them all up 'just in case'. 

Andrew Bartlett

-- 
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba