diff --git a/manifests/compute/hypervisor.pp b/manifests/compute/hypervisor.pp index d6ca37fe..12329acc 100644 --- a/manifests/compute/hypervisor.pp +++ b/manifests/compute/hypervisor.pp @@ -102,13 +102,6 @@ Host * } - class { 'nova::compute::libvirt': - libvirt_type => $libvirt_type, - # Needed to support migration but we still use Spice: - vncserver_listen => '0.0.0.0', - migration_support => true, - } - Service<| title == 'dbus' |> { enable => true } Service<| title == 'libvirt-bin' |> { enable => true } @@ -116,6 +109,7 @@ Host * if $has_ceph { + $libvirt_disk_cachemodes_real = ['network=writeback'] include 'cloud::storage::rbd' # TODO(EmilienM) Temporary, while https://review.openstack.org/#/c/72440 got merged @@ -132,7 +126,6 @@ Host * 'DEFAULT/libvirt_inject_key': value => false; 'DEFAULT/libvirt_inject_partition': value => '-2'; 'DEFAULT/live_migration_flag': value => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST'; - 'DEFAULT/disk_cachemodes': value => 'network=writeback'; } File <<| tag == 'ceph_compute_secret_file' |>> @@ -147,6 +140,16 @@ Host * require => Ceph::Key[$cinder_rbd_user] } Concat::Fragment <<| title == 'ceph-client-os' |>> + } else { + $libvirt_disk_cachemodes_real = [] + } + + class { 'nova::compute::libvirt': + libvirt_type => $libvirt_type, + # Needed to support migration but we still use Spice: + vncserver_listen => '0.0.0.0', + migration_support => true, + libvirt_disk_cachemodes => $libvirt_disk_cachemodes_real } class { 'ceilometer::agent::compute': } diff --git a/spec/classes/cloud_compute_hypervisor_spec.rb b/spec/classes/cloud_compute_hypervisor_spec.rb index bc10ef20..4fd52157 100644 --- a/spec/classes/cloud_compute_hypervisor_spec.rb +++ b/spec/classes/cloud_compute_hypervisor_spec.rb @@ -220,7 +220,8 @@ describe 'cloud::compute::hypervisor' do should contain_class('nova::compute::libvirt').with( :libvirt_type => 'kvm', :vncserver_listen => '0.0.0.0', - :migration_support => true + :migration_support => true, + :libvirt_disk_cachemodes => ['network=writeback'] ) end @@ -245,7 +246,6 @@ describe 'cloud::compute::hypervisor' do should contain_nova_config('DEFAULT/libvirt_inject_key').with('value' => false) should contain_nova_config('DEFAULT/libvirt_inject_partition').with('value' => '-2') should contain_nova_config('DEFAULT/live_migration_flag').with('value' => 'VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST') - should contain_nova_config('DEFAULT/disk_cachemodes').with('value' => 'network=writeback') end context 'without RBD backend' do @@ -256,6 +256,14 @@ describe 'cloud::compute::hypervisor' do it 'should not configure nova-compute for RBD backend' do should_not contain_nova_config('DEFAULT/rbd_user').with('value' => 'cinder') end + it 'configure libvirt driver without disk cachemodes' do + should contain_class('nova::compute::libvirt').with( + :libvirt_type => 'kvm', + :vncserver_listen => '0.0.0.0', + :migration_support => true, + :libvirt_disk_cachemodes => [] + ) + end end end