@@ -202,9 +202,9 @@ def lookup(self):
202
202
for item in self .existing_storages :
203
203
if item ['storage' ] == self .name :
204
204
# pvesh doesn't return the disable param value if it's false,
205
- # so we set it to False .
205
+ # so we set it to 0, which is what PVE would normally use .
206
206
if item .get ('disable' ) is None :
207
- item ['disable' ] = False
207
+ item ['disable' ] = 0
208
208
return item
209
209
return None
210
210
@@ -218,13 +218,15 @@ def prepare_storage_args(self):
218
218
args = {}
219
219
220
220
args ['type' ] = self .type
221
- args ['content' ] = ',' .join (self .content )
221
+ if self .content is not None and len (self .content ) > 0 :
222
+ args ['content' ] = ',' .join (self .content )
223
+ else :
224
+ # PVE uses "none" to represent when no content types are selected
225
+ args ['content' ] = 'none'
222
226
if self .nodes is not None :
223
227
args ['nodes' ] = ',' .join (self .nodes )
224
228
if self .disable is not None :
225
- args ['disable' ] = self .disable
226
- else :
227
- args ['disable' ] = False
229
+ args ['disable' ] = 1 if self .disable else 0
228
230
if self .path is not None :
229
231
args ['path' ] = self .path
230
232
if self .pool is not None :
@@ -234,7 +236,7 @@ def prepare_storage_args(self):
234
236
if self .username is not None :
235
237
args ['username' ] = self .username
236
238
if self .krbd is not None :
237
- args ['krbd' ] = self .krbd
239
+ args ['krbd' ] = 1 if self .krbd else 0
238
240
if self .maxfiles is not None :
239
241
args ['maxfiles' ] = self .maxfiles
240
242
if self .server is not None :
@@ -248,7 +250,7 @@ def prepare_storage_args(self):
248
250
if self .thinpool is not None :
249
251
args ['thinpool' ] = self .thinpool
250
252
if self .sparse is not None :
251
- args ['sparse' ] = self .sparse
253
+ args ['sparse' ] = 1 if self .sparse else 0
252
254
253
255
if self .maxfiles is not None and 'backup' not in self .content :
254
256
self .module .fail_json (msg = "maxfiles is not allowed when there is no 'backup' in content" )
@@ -275,7 +277,8 @@ def modify_storage(self):
275
277
276
278
for key in new_storage :
277
279
if key == 'content' :
278
- if set (self .content ) != set (lookup .get ('content' , '' ).split (',' )):
280
+ if set (new_storage ['content' ].split (',' )) \
281
+ != set (lookup .get ('content' , '' ).split (',' )):
279
282
updated_fields .append (key )
280
283
staged_storage [key ] = new_storage [key ]
281
284
elif key == 'monhost' :
0 commit comments