Enforce permissions in snapshots temporary dir

Live snapshots creates a temporary directory where libvirt driver
creates a new image from the instance's disk using blockRebase.
Currently this directory is created with 777 permissions making this
directory accessible by all the users in the system.

This patch changes the tempdir permissions so they have the o+x
flag set, which is what libvirt needs to be able to write in it and

Closes-Bug: #1227027
Change-Id: I767ff5247b4452821727e92b668276004fc0f84d
This commit is contained in:
Xavier Queralt 2013-11-27 20:44:36 +01:00
parent 164d0b06a9
commit 8a34fc3d48
1 changed files with 2 additions and 3 deletions

View File

@ -1488,9 +1488,8 @@ class LibvirtDriver(driver.ComputeDriver):
try: try:
out_path = os.path.join(tmpdir, snapshot_name) out_path = os.path.join(tmpdir, snapshot_name)
if live_snapshot: if live_snapshot:
# NOTE (rmk): libvirt needs to be able to write to the # NOTE(xqueralt): libvirt needs o+x in the temp directory
# temp directory, which is owned nova. os.chmod(tmpdir, 0o701)
utils.execute('chmod', '777', tmpdir, run_as_root=True)
self._live_snapshot(virt_dom, disk_path, out_path, self._live_snapshot(virt_dom, disk_path, out_path,
image_format) image_format)
else: else: