Skip to content

Commit a9daaae

Browse files
committed
Merge pull request #186 from fasrc/onedatastore-driver-config
add DRIVER property to onedatastore provider
2 parents 8288d48 + 04e7bf8 commit a9daaae

5 files changed

Lines changed: 15 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ onedatastore { '<name>':
115115
type => 'IMAGE_DS' | 'SYSTEM_DS' | 'FILE_DS',
116116
dm => 'fs' | 'vmware' | 'iscsi' | 'lvm' | 'vmfs' | 'ceph',
117117
tm => 'shared' | 'ssh' | 'qcow2' | 'iscsi' | 'lvm' | 'vmfs' | 'ceph' | 'dummy',
118+
driver => 'raw | qcow2',
118119
cephhost => 'cephhost', # (optional: ceph only)
119120
cephuser => 'cephuser', # (optional: ceph only)
120121
cephsecret => 'ceph-secret-here', # (optional: ceph only)

lib/puppet/provider/onedatastore/cli.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def create
3535
end if resource[:safe_dirs]
3636
xml.DS_MAD resource[:dm]
3737
xml.DISK_TYPE resource[:disktype]
38+
xml.DRIVER resource[:driver]
3839
xml.BRIDGE_LIST resource[:bridgelist]
3940
xml.CEPH_HOST resource[:cephhost]
4041
xml.CEPH_USER resource[:cephuser]
@@ -80,6 +81,7 @@ def self.instances
8081
:cephsecret => (datastore.xpath('./TEMPLATE/CEPH_SECRET').text unless datastore.xpath('./TEMPLATE/CEPH_SECRET').nil?),
8182
:poolname => (datastore.xpath('./TEMPLATE/POOL_NAME').text unless datastore.xpath('./TEMPLATE/POOL_NAME').nil?),
8283
:stagingdir => (datastore.xpath('./TEMPLATE/STAGING_DIR').text unless datastore.xpath('./TEMPLATE/STAGING_DIR').nil?),
84+
:driver => (datastore.xpath('./TEMPLATE/DRIVER').text unless datastore.xpath('./TEMPLATE/DRIVER').nil?),
8385
:disktype => {'0' => 'file', '1' => 'block', '3' => 'rbd'}[datastore.xpath('./DISK_TYPE').text]
8486
)
8587
end

lib/puppet/type/onedatastore.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
desc "Choose a disk type: file, block, rdb"
5353
end
5454

55+
newproperty(:driver) do
56+
desc "Choose a driver: raw, qcow2"
57+
end
58+
5559
newproperty(:basepath) do
5660
desc "Choose a base path"
5761
end

spec/acceptance/onedatastore_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class { 'one':
9090
onedatastore { 'ceph_ds':
9191
dm => 'ceph',
9292
tm => 'ceph',
93+
driver => 'raw',
9394
cephhost => 'cephhost',
9495
cephuser => 'cephuser',
9596
cephsecret => 'cephsecret',

spec/type/onedatastore_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
res_type.key_attributes.should == [:name]
2727
end
2828

29-
properties = [:type, :dm, :tm, :disktype, :cephhost, :cephuser, :cephsecret,
30-
:poolname, :bridgelist]
29+
properties = [:type, :dm, :tm, :disktype, :driver, :cephhost, :cephuser,
30+
:cephsecret, :poolname, :bridgelist]
3131
properties.each do |property|
3232
it "should have a #{property} property" do
3333
described_class.attrclass(property).ancestors.should be_include(Puppet::Property)
@@ -58,6 +58,11 @@
5858
@datastore[:disktype].should == 'file'
5959
end
6060

61+
it 'should have property :driver' do
62+
@datastore[:driver] = 'qcow2'
63+
@datastore[:driver].should == 'qcow2'
64+
end
65+
6166
it 'should have property :cephhost' do
6267
@datastore[:cephhost] = 'cephhost'
6368
@datastore[:cephhost].should == 'cephhost'

0 commit comments

Comments
 (0)