Change in vdsm[master]: serial console: add code to prepare the path

Alon Bar-Lev alonbl at redhat.com
Thu Jun 4 11:00:46 UTC 2015


Alon Bar-Lev has posted comments on this change.

Change subject: serial console: add code to prepare the path
......................................................................


Patch Set 4:

(2 comments)

https://gerrit.ovirt.org/#/c/41896/4/vdsm/vmconsole.py
File vdsm/vmconsole.py:

Line 49:     """
Line 50: 
Line 51: 
Line 52: def create_directory(path):
Line 53:     dirname = tempfile.mkdtemp()
please use:

 dirname = tempfile.mkdtemp(dir=os.path.basename(path))

this will create the temp dir in the same filesystem (well, higher chance of) so the rename bellow will actually work and be atomic.
Line 54: 
Line 55:     os.makedirs(dirname, mode=_VIRT_VMCONSOLE_MODE)
Line 56:     chown(dirname, VDSM_USER, QEMU_PROCESS_GROUP)
Line 57:     selinux.chcon(dirname, _SELINUX_VIRT_VMCONSOLE_LABEL)


Line 89:     mode = stat.S_IMODE(fsinfo.st_mode)
Line 90:     if (mode & mask) != mask:
Line 91:         return False
Line 92: 
Line 93:     return True
now that I see these checks... it may have side effect that if we ever modify it then it will be very difficult to update.

I suggest to check only ownership as a sanity not more.


-- 
To view, visit https://gerrit.ovirt.org/41896
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6f851d7f7233265d33896b3aad5604e84c8af53b
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alonbl at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Michal Skrivanek <mskrivan at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list