Revision ec3a7362 lib/cmdlib/instance.py
b/lib/cmdlib/instance.py | ||
---|---|---|
294 | 294 |
disk_sizes, spindle_use, disk_template) |
295 | 295 |
|
296 | 296 |
|
297 |
def _CheckOSVariant(os_obj, name): |
|
298 |
"""Check whether an OS name conforms to the os variants specification. |
|
299 |
|
|
300 |
@type os_obj: L{objects.OS} |
|
301 |
@param os_obj: OS object to check |
|
302 |
@type name: string |
|
303 |
@param name: OS name passed by the user, to check for validity |
|
304 |
|
|
305 |
""" |
|
306 |
variant = objects.OS.GetVariant(name) |
|
307 |
if not os_obj.supported_variants: |
|
308 |
if variant: |
|
309 |
raise errors.OpPrereqError("OS '%s' doesn't support variants ('%s'" |
|
310 |
" passed)" % (os_obj.name, variant), |
|
311 |
errors.ECODE_INVAL) |
|
312 |
return |
|
313 |
if not variant: |
|
314 |
raise errors.OpPrereqError("OS name must include a variant", |
|
315 |
errors.ECODE_INVAL) |
|
316 |
|
|
317 |
if variant not in os_obj.supported_variants: |
|
318 |
raise errors.OpPrereqError("Unsupported OS variant", errors.ECODE_INVAL) |
|
319 |
|
|
320 |
|
|
321 | 297 |
def _ComputeInstanceCommunicationNIC(instance_name): |
322 | 298 |
"""Compute the name of the instance NIC used by instance |
323 | 299 |
communication. |
Also available in: Unified diff