From 7f064e855378e3ade9988170af506b2dd180f32e Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Fri, 14 Aug 2015 12:58:32 +0300 Subject: [PATCH] vmware: use cache_prefix to preserve cache directory Currently value of `my_ip' config option is used as image cache dir prefix to prevent races between nova-compute instances using the same datastore. The common practice of making nova-compute (with vmwareapi driver chosen) HA is to have it run in active/passive mode controlled by Pacemaker. In that case Pacemaker can move nova-compute instance to another host, should something happen to the original one, which effectively will cause change of the IP address - thus, all cached images will have to be re-downloaded again, despite the fact they are still there in the datastore and still belong to this particular nova-compute instance. I02e758af19cf3a652a5c39d02904e73a1088fe60 made it possible to use the `cache_prefix' config option to denote, which cache directory should be used by a particular nova-compute instance. As long as we set the same `cache_prefix' value for all nova-compute processes running in active/passive mode, the cache directory will be the same on every host. Closes-Bug: #1482121 Change-Id: Id70dd29a757f41c9d02a3573c6581ba29e63b191 --- deployment/puppet/vmware/templates/nova-compute.conf.erb | 2 ++ tests/noop/spec/hosts/vmware/compute-vmware_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/deployment/puppet/vmware/templates/nova-compute.conf.erb b/deployment/puppet/vmware/templates/nova-compute.conf.erb index a48711f201..f04077c03c 100644 --- a/deployment/puppet/vmware/templates/nova-compute.conf.erb +++ b/deployment/puppet/vmware/templates/nova-compute.conf.erb @@ -5,6 +5,8 @@ host=<%= @availability_zone_name %>-<%= @service_name %> [vmware] +cache_prefix=$host + cluster_name=<%= @vc_cluster %> host_ip=<%= @vc_host %> host_username=<%= @vc_user %> diff --git a/tests/noop/spec/hosts/vmware/compute-vmware_spec.rb b/tests/noop/spec/hosts/vmware/compute-vmware_spec.rb index 7d37cd92ad..e73d6e2f0c 100644 --- a/tests/noop/spec/hosts/vmware/compute-vmware_spec.rb +++ b/tests/noop/spec/hosts/vmware/compute-vmware_spec.rb @@ -3,6 +3,13 @@ require 'shared-examples' manifest = 'vmware/compute-vmware.pp' describe manifest do + shared_examples 'catalog' do + it 'should have cache_prefix option set to $host' do + should contain_file('/etc/nova/nova-compute.conf').with_content( + %r{\n\s*cache_prefix=\$host\n} + ) + end + end test_ubuntu_and_centos manifest end