+def _CheckOSVariant(os, name):
+ """Check whether an OS name conforms to the os variants specification.
+
+ @type os: L{objects.OS}
+ @param os: OS object to check
+ @type name: string
+ @param name: OS name passed by the user, to check for validity
+
+ """
+ if not os.supported_variants:
+ return
+ try:
+ variant = name.split("+", 1)[1]
+ except IndexError:
+ raise errors.OpPrereqError("OS name must include a variant")
+
+ if variant not in os.supported_variants:
+ raise errors.OpPrereqError("Unsupported OS variant")
+
+