diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-04-09 15:58:55 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-04-09 15:58:55 +0000 |
| commit | 3584c000de70e10f193bfe99bcddaae5bf45028b (patch) | |
| tree | 9cf3fc6f1fdedfac4b3e8a7f65e7be057a24874b /nova/virt | |
| parent | f6ae266057fee59fa8f8cb02c98661b3cb830125 (diff) | |
| parent | 52f6981aa35e27c48587ad2320891db8364edd02 (diff) | |
| download | nova-3584c000de70e10f193bfe99bcddaae5bf45028b.tar.gz nova-3584c000de70e10f193bfe99bcddaae5bf45028b.tar.xz nova-3584c000de70e10f193bfe99bcddaae5bf45028b.zip | |
Merge "Evacuated instance disk not deleted"
Diffstat (limited to 'nova/virt')
| -rwxr-xr-x | nova/virt/driver.py | 27 | ||||
| -rwxr-xr-x | nova/virt/libvirt/driver.py | 19 |
2 files changed, 46 insertions, 0 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 827a2b782..b3854aba0 100755 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -487,6 +487,33 @@ class ComputeDriver(object): """ raise NotImplementedError() + def check_instance_shared_storage_local(self, ctxt, instance): + """Check if instance files located on shared storage. + + This runs check on the destination host, and then calls + back to the source host to check the results. + + :param ctxt: security context + :param instance: nova.db.sqlalchemy.models.Instance + """ + raise NotImplementedError() + + def check_instance_shared_storage_remote(self, ctxt, data): + """Check if instance files located on shared storage. + + :param context: security context + :param data: result of check_instance_shared_storage_local + """ + raise NotImplementedError() + + def check_instance_shared_storage_cleanup(self, ctxt, data): + """Do cleanup on host after check_instance_shared_storage calls + + :param ctxt: security context + :param data: result of check_instance_shared_storage_local + """ + pass + def check_can_live_migrate_destination(self, ctxt, instance_ref, src_compute_info, dst_compute_info, block_migration=False, diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 7785d13e2..c8494603e 100755 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2826,6 +2826,25 @@ class LibvirtDriver(driver.ComputeDriver): 'disk_available_least': _get_disk_available_least()} return dic + def check_instance_shared_storage_local(self, ctxt, instance): + dirpath = libvirt_utils.get_instance_path(instance) + + if not os.path.exists(dirpath): + return None + + fd, tmp_file = tempfile.mkstemp(dir=dirpath) + LOG.debug(_("Creating tmpfile %s to verify with other " + "compute node that the instance is on " + "the same shared storage.") % tmp_file) + os.close(fd) + return {"filename": tmp_file} + + def check_instance_shared_storage_remote(self, ctxt, data): + return os.path.exists(data['filename']) + + def check_instance_shared_storage_cleanup(self, ctxt, data): + utils.delete_if_exists(data["filename"]) + def check_can_live_migrate_destination(self, ctxt, instance_ref, src_compute_info, dst_compute_info, block_migration=False, |
