diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-05 22:10:53 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-05 22:10:53 +0000 |
| commit | 6335e66e1c1a825c28cb7beb46ef913401693bae (patch) | |
| tree | 008db2a38d248e98b89d79870dd81bff36a3f938 | |
| parent | 974233db34c66173f9b98cf161734aaf11db20f6 (diff) | |
| parent | 70129ed19db187cc90f74abd5c93c86098d29c27 (diff) | |
Merge "Make possible to store snapshots not in /tmp directory"
| -rw-r--r-- | nova/tests/test_virt_drivers.py | 3 | ||||
| -rw-r--r-- | nova/virt/libvirt/driver.py | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py index 33253ac92..56efc75f9 100644 --- a/nova/tests/test_virt_drivers.py +++ b/nova/tests/test_virt_drivers.py @@ -79,7 +79,8 @@ class _FakeDriverBackendTestCase(test.TestCase): self.flags(firewall_driver=nova.virt.libvirt.firewall.drivers[0], rescue_image_id="2", rescue_kernel_id="3", - rescue_ramdisk_id=None) + rescue_ramdisk_id=None, + libvirt_snapshots_directory='./') def fake_extend(image, size): pass diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 2c3101a2c..14f5620c9 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -176,6 +176,10 @@ libvirt_opts = [ help='Set to a named libvirt CPU model (see names listed ' 'in /usr/share/libvirt/cpu_map.xml). Only has effect if ' 'libvirt_cpu_mode="custom" and libvirt_type="kvm|qemu"'), + cfg.StrOpt('libvirt_snapshots_directory', + default='$instances_path/snapshots', + help='Location where libvirt driver will store snapshots ' + 'before uploading them to image service'), ] FLAGS = flags.FLAGS @@ -794,7 +798,9 @@ class LibvirtDriver(driver.ComputeDriver): libvirt_utils.create_snapshot(disk_path, snapshot_name) # Export the snapshot to a raw image - with utils.tempdir() as tmpdir: + snapshot_directory = FLAGS.libvirt_snapshots_directory + libvirt_utils.ensure_tree(snapshot_directory) + with utils.tempdir(dir=snapshot_directory) as tmpdir: try: out_path = os.path.join(tmpdir, snapshot_name) libvirt_utils.extract_snapshot(disk_path, source_format, |
