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
This commit is contained in:
Roman Podoliaka 2015-08-14 12:58:32 +03:00
parent ed5e1b1a63
commit 7f064e8553
2 changed files with 9 additions and 0 deletions

View File

@ -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 %>

View File

@ -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