Bug 34725 - uvmm/node.py use shutil.move instead of os.rename
uvmm/node.py use shutil.move instead of os.rename
Product: UCS
Classification: Unclassified
Component: Virtualization - UVMM
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 3.2-4-errata
Assigned To: Philipp Hahn
Erik Damrose
Depends on:
Blocks: 36988
  Show dependency treegraph
Reported: 2014-05-02 11:42 CEST by Janis Meybohm
Modified: 2015-01-21 12:23 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted after Product Owner Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Note You need to log in before you can comment on or make changes to this bug.
Description Janis Meybohm univentionstaff 2014-05-02 11:42:45 CEST

node.py breaks when cache dir is on a different partition than /tmp/. The use of os.rename should be avoided, it should be replaced with shutil.move 

2014-04-30 13:40:22,664 - uvmmd.node - ERROR - ('qemu://SERVER1.tlt.local/system',): Exception in timer_callbck
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/uvmm/node.py", line 578, in run
  File "/usr/lib/pymodules/python2.6/univention/uvmm/node.py", line 597, in update_autoreconnect
  File "/usr/lib/pymodules/python2.6/univention/uvmm/node.py", line 771, in update
  File "/usr/lib/pymodules/python2.6/univention/uvmm/node.py", line 790, in write_novnc_tokens
    os.rename(tmp_file.name, path)
OSError: [Errno 18] Invalid cross-device link
Comment 1 Philipp Hahn univentionstaff 2014-05-02 11:47:42 CEST
(In reply to Janis Meybohm from comment #0)
> The use of os.rename should be avoided, it should be replaced with shutil.move 

No: cross-device renames are not atomic and introduce other cases with file permission/disc full/etc.
The file should instead be created inside the same directory with a prefix/suffix/different name and then be renamed.
Comment 2 Janis Meybohm univentionstaff 2014-11-17 15:29:48 CET

Reported again.
Comment 3 Janis Meybohm univentionstaff 2014-11-25 08:54:12 CET
Reported Again
Comment 4 Philipp Hahn univentionstaff 2014-11-26 21:51:22 CET
r56208 | Bug #34725 UVMM: Fix noVNC temporary file location
r56210 | Bug #34725 UVMM: Fix noVNC temporary file location YAML

Package: univention-virtual-machine-manager-daemon
Version: 3.0.18-2.562.201411262140
Branch: ucs_3.2-0
Scope: errata3.2-4
Comment 5 Erik Damrose univentionstaff 2015-01-21 09:22:50 CET
OK: temporary file is created in the same directory as the target file, still use os.rename to replace the original file
Comment 6 Moritz Muehlenhoff univentionstaff 2015-01-21 12:23:41 CET