Statistics
| Branch: | Tag: | Revision:

root / lib / utils @ 463f75a5

Name Size
__init__.py 21 kB
algo.py 4.2 kB
filelock.py 5 kB
hash.py 2.4 kB
io.py 20.5 kB
log.py 8.4 kB
mlock.py 2.3 kB
nodesetup.py 3.3 kB
process.py 28.2 kB
retry.py 6.2 kB
text.py 14 kB
wrapper.py 4.8 kB
x509.py 9.2 kB

Latest revisions

# Date Author Comment
bd614fa4 05/24/2011 07:40 pm Michael Hanselmann

Merge branch 'devel-2.4'

  • devel-2.4:
    RPC/Backend: Make UploadFile uid and gid agnostic
    Resolve uid/gid upon mainloop run
    GetEntResolver: Make it possible to resolve uid/gid to name
    utils.algo: Add InvertDict to invert a dict
    autotools: Add noded group...
0a9a0e5a 05/24/2011 12:37 pm René Nussbaumer

utils.algo: Add InvertDict to invert a dict

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

580c971e 04/29/2011 03:38 pm Michael Hanselmann

Merge branch 'devel-2.4'

  • devel-2.4: (24 commits)
    mlock: fail gracefully if libc.so.6 cannot be loaded
    Allow creating the DRBD metadev in a different VG
    Make _GenerateDRBD8Branch accept different VG names
    Fix WriteFile with unicode data
    Replace disks: keep the meta device in the same VG...
adc523ab 04/29/2011 03:05 pm Iustin Pop

mlock: fail gracefully if libc.so.6 cannot be loaded

This allows noded to continue instead of blowing up if the libc major
number changes.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

55f67cc9 04/28/2011 03:24 pm Iustin Pop

Fix 'unused import' lint error

Sorry!

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

8f9a87c5 04/28/2011 01:06 pm Iustin Pop

SetEtcHostsEntry: maintain existing ordering

Currently RemoveEtcHostsEntry keeps the ordering, but SetEtcHostsEntry
not, as it will always write the new entry at the end of file. I
personally dislike this as it "uglifies" my custom host files, so this
patch makes it update the record instead in-place so to say instead of...

24c855a7 04/28/2011 01:06 pm Iustin Pop

Convert utils.nodesetup to utils.WriteFile(data=…)

It makes no sense to iteratively write the new etc/hosts file, as we
can pre-compute the desired contents (neither the old nor the new
versions are safe against concurrent changes anyway).

Signed-off-by: Iustin Pop <>...

1d39e245 04/28/2011 01:02 pm Iustin Pop

Fix WriteFile with unicode data

Unicode is fun, indeed:

len(buffer("abc"))

3

len(buffer(u"abc"))

12

So we can't pass unicode data to buffer(), as the result will be to
write the in-memory (usually UTF-32) representation to disk.

Signed-off-by: Iustin Pop <>...

437c3e77 04/27/2011 06:26 pm Iustin Pop

Fix potential data-loss in utils.WriteFile

os.write can do incomplete writes, as long as at least some bytes have
been written (like write(2)):

os.write(fd, " " * 1300)

1300

os.write(fd, " " * 1300)

1300

os.write(fd, " " * 1300)

1300

os.write(fd, " " * 1300)...

a9d68e40 04/13/2011 01:01 pm Michael Hanselmann

utils.WriteFile: Close file before renaming

Issue 154 (http://code.google.com/p/ganeti/issues/detail?id=154)
reported an “Operation not supported” error when writing instance
exports to a mounted CIFS filesystem. Experimentation showed the error
to only occur when using rename(2) on an opened file. Various references...

View revisions

Also available in: Atom