From 8be60f0a405dfa0d5dbfebd278b271591c29cc02 Mon Sep 17 00:00:00 2001 From: Pavel Glushchak Date: Tue, 16 May 2017 18:43:07 +0300 Subject: [PATCH] VStorage: manage volume types for ploop and qcow2 volumes VStorage driver can create volumes in multiple formats, that are suitable for both virtual machines (qcow2) and containers (ploop). To choose between volume formats the vendor property vz:volume_format should be set in volume type extra specs. Thus we need 2 volume types to support both VMs and containers. Change-Id: I7ffce9c16dfa524a3eac2e8d12ad7fd0b682eba6 Depends-On: Ib610e6f9c82259f9dd2db37178b24d964a38e20d Signed-off-by: Pavel Glushchak --- manifests/backend/vstorage.pp | 6 +++++- spec/defines/cinder_backend_vstorage_spec.rb | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/manifests/backend/vstorage.pp b/manifests/backend/vstorage.pp index 0f0ef7ab..2244ba9d 100644 --- a/manifests/backend/vstorage.pp +++ b/manifests/backend/vstorage.pp @@ -87,7 +87,11 @@ define cinder::backend::vstorage ( if $manage_volume_type { cinder_type { $volume_backend_name: ensure => present, - properties => ["volume_backend_name=${volume_backend_name}"], + properties => ['vz:volume_format=qcow2'], + } + cinder_type { "${volume_backend_name}-ploop": + ensure => present, + properties => ['vz:volume_format=ploop'], } } diff --git a/spec/defines/cinder_backend_vstorage_spec.rb b/spec/defines/cinder_backend_vstorage_spec.rb index c71d5812..77879b92 100644 --- a/spec/defines/cinder_backend_vstorage_spec.rb +++ b/spec/defines/cinder_backend_vstorage_spec.rb @@ -52,10 +52,13 @@ describe 'cinder::backend::vstorage' do before do params.merge!({:manage_volume_type => true}) end - it 'should create volume type' do + it 'should create volume types' do should contain_cinder_type('vstorage').with( :ensure => :present, - :properties => ['volume_backend_name=vstorage']) + :properties => ['vz:volume_format=qcow2']) + should contain_cinder_type('vstorage-ploop').with( + :ensure => :present, + :properties => ['vz:volume_format=ploop']) end end