I tried to repeatedly reproduce the error. I removed the rw-permission
from abstractions/libvirt-qemu, reloaded the apparmor-profiles. I start
an new intstance an try to get an snapshot.

I have added some debug-output to the soruce code of /usr/lib/python2.7
/dist-packages/nova/virt/libvirt/driver.py to check if the directory
exists or not.

            disk_delta = out_path + '.delta'
            ...
            import os.path
            disk_delta_exists = os.path.isfile(disk_delta)
            LOG.debug(_("disk_delta_exists: %s") % disk_delta_exists)

            domain.blockRebase(disk_path, disk_delta, 0,
                               libvirt.VIR_DOMAIN_BLOCK_REBASE_COPY |
                               libvirt.VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT |
                               libvirt.VIR_DOMAIN_BLOCK_REBASE_SHALLOW)

             LOG.debug(_("disk_delta_exists2: %s") % disk_delta_exists)


This leads to this debug-log:

2013-11-27 09:21:21.172 5568 DEBUG nova.virt.libvirt.driver 
[req-5bd8a420-2747-490f-a688-7468ffcd3c00 b6d2602f38914f20a0fec492fd1482e8 
32c4869a7fee41ecb953cd00
c3e71eac] disk_delta_exists: True _live_snapshot 
/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py:1484
2013-11-27 09:21:21.500 5568 INFO nova.virt.libvirt.driver 
[req-5bd8a420-2747-490f-a688-7468ffcd3c00 b6d2602f38914f20a0fec492fd1482e8 
32c4869a7fee41ecb953cd00c
3e71eac] [instance: df82e015-077c-48d7-8008-5b5f64efb6da] Snapshot extracted, 
beginning image upload
2013-11-27 09:21:21.500 5568 DEBUG nova.compute.manager 
[req-5bd8a420-2747-490f-a688-7468ffcd3c00 b6d2602f38914f20a0fec492fd1482e8 
32c4869a7fee41ecb953cd00c3e7
1eac] [instance: df82e015-077c-48d7-8008-5b5f64efb6da] Cleaning up image 
a2074ffb-e556-4263-9843-698867e79dae decorated_function 
/usr/lib/python2.7/dist-packag
es/nova/compute/manager.py:313
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da] Traceback (most recent call last):
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/nova/compute/
manager.py", line 309, in decorated_function
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     *args, **kwargs)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/nova/compute/
manager.py", line 2293, in snapshot_instance
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     task_states.IMAGE_SNAPSHOT)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/nova/compute/
manager.py", line 2324, in _snapshot_instance
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     update_task_state)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/nova/virt/lib
virt/driver.py", line 1400, in snapshot
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     image_format)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/nova/virt/lib
virt/driver.py", line 1489, in _live_snapshot
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     
libvirt.VIR_DOMAIN_BLOCK_REBASE_SHALLOW)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/eventlet/tpoo
l.py", line 179, in doit
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     result = proxy_call(self._autowrap, 
f, *args, **kw
args)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/eventlet/tpoo
l.py", line 139, in proxy_call
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     rv = execute(f,*args,**kwargs)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/eventlet/tpoo
l.py", line 77, in tworker
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     rv = meth(*args,**kwargs)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]   File 
"/usr/lib/python2.7/dist-packages/libvirt.py", 
line 646, in blockRebase
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da]     if ret == -1: raise libvirtError 
('virDomainBlockR
ebase() failed', dom=self)
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da] libvirtError: internal error: unable to 
execute QEMU c
ommand 'drive-mirror': Could not open 
'/var/lib/nova/instances/snapshots/tmpT2Tjwy/808390b3031d4e93813293551ef63b12.delta'
2013-11-27 09:21:21.500 5568 TRACE nova.compute.manager [instance: 
df82e015-077c-48d7-8008-5b5f64efb6da] 
2013-11-27 09:21:21.502 5568 DEBUG stevedore.extension [-] found extension 
EntryPoint.parse('file = nova.image.download.file') _load_plugins 
/usr/lib/python2.7
/dist-packages/stevedore/extension.py:84
2013-11-27 09:21:21.503 5568 DEBUG stevedore.extension [-] found extension 
EntryPoint.parse('file = nova.image.download.file') _load_plugins 
/usr/lib/python2.7
/dist-packages/stevedore/extension.py:84

I think the tmp-directory is create and removed with the root-wrapper and 
fileutils.ensure_tree(snapshot_directory) innova/virt/libvirt/driver.py .
Like the debug-output shows, the directory exists before the original image ist 
rebased in /usr/lib/python2.7/dist-packages/libvirt.py.

Ok so far, i have to change my statement at #13, maybe the profile was
yet in clomplain-mode, but now in enfoce-mode i get another apparmor-
denied-log:

Nov 27 10:09:17 compute1 kernel: [1886126.137124] type=1400 
audit(1385546957.245:20429): apparmor="STATUS" operation="profile_replace" 
parent=2173 profile="unconfined" 
name="libvirt-fd3eeca4-ab20-4675-8d35-ba786f378893" pid=2174 
comm="apparmor_parser"
Nov 27 10:09:17 compute1 kernel: [1886126.145251] type=1400 
audit(1385546957.253:20430): apparmor="DENIED" operation="file_perm" parent=1 
profile="libvirt-fd3eeca4-ab20-4675-8d35-ba786f378893" 
name="/var/lib/nova/instances/fd3eeca4-ab20-4675-8d35-ba786f378893/disk" 
pid=2063 comm="qemu-system-x86" requested_mask="r" denied_mask="r" fsuid=110 
ouid=110

As at #12 there is no entry for original disk(s)
"/var/lib/nova/instances/fd3eeca4-ab20-4675-8d35-ba786f378893/disk" in
the newly replaced profile:

# DO NOT EDIT THIS FILE DIRECTLY. IT IS MANAGED BY LIBVIRT.
  "/var/log/libvirt/**/instance-00000038.log" w,
  "/var/lib/libvirt/**/instance-00000038.monitor" rw,
  "/var/run/libvirt/**/instance-00000038.pid" rwk,
  "/run/libvirt/**/instance-00000038.pid" rwk,
  "/var/run/libvirt/**/*.tunnelmigrate.dest.instance-00000038" rw,
  "/run/libvirt/**/*.tunnelmigrate.dest.instance-00000038" rw,
  
"/var/lib/nova/instances/snapshots/tmp6O67qv/501781885d94440faa1709ffbe5710b3.delta"
 rw,
  "/var/lib/nova/instances/fd3eeca4-ab20-4675-8d35-ba786f378893/console.log" rw,
  "/var/lib/nova/instances/fd3eeca4-ab20-4675-8d35-ba786f378893/console.log" rw,
  
"/var/lib/nova/instances/snapshots/tmp6O67qv/501781885d94440faa1709ffbe5710b3.delta"
 rw,

I tried that with different instances and the latest nova-python and
libvirt-bin packages.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to nova in Ubuntu.
https://bugs.launchpad.net/bugs/1244694

Title:
  Creating snapshot fails due to nonexistent temporary directory

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1244694/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to