COT.platforms.generic module¶
API and generic implementation of platform-specific logic.
-
class
GenericPlatform[source]¶ Bases:
objectGeneric class for operations that depend on guest platform.
To be used whenever the guest is unrecognized or does not need special handling.
-
classmethod
controller_type_for_device(device_type)[source]¶ Get the default controller type for the given device type.
Parameters: device_type (str) – ‘harddisk’, ‘cdrom’, etc. Returns: str – ‘ide’ unless overridden by subclass.
-
classmethod
guess_nic_name(nic_number)[source]¶ Guess the name of the Nth NIC for this platform.
Note
This method counts from 1, not from 0!
Parameters: nic_number (int) – Nth NIC to name. Returns: str – “Ethernet1”, “Ethernet2”, etc. unless overridden by subclass.
-
classmethod
validate_cpu_count(cpus)[source]¶ Throw an error if the number of CPUs is not a supported value.
Parameters: cpus (int) – Number of CPUs
Raises: ValueTooLowError– ifcpusis less than the minimum required by this platformValueTooHighError– ifcpusexceeds the maximum supported by this platform
-
classmethod
validate_memory_amount(mebibytes)[source]¶ Throw an error if the amount of RAM is not supported.
Parameters: mebibytes (int) – RAM, in MiB.
Raises: ValueTooLowError– ifmebibytesis less than the minimumrequired by this platform
- ValueTooHighError: if
mebibytesis more than the maximum supported by this platform
- ValueTooHighError: if
-
classmethod
validate_nic_count(count)[source]¶ Throw an error if the number of NICs is not supported.
Parameters: count (int) – Number of NICs.
Raises: ValueTooLowError– ifcountis less than the minimum required by this platformValueTooHighError– ifcountis more than the maximum supported by this platform
-
classmethod
validate_nic_type(type_string)[source]¶ Throw an error if the NIC type string is not supported.
Parameters: type_string (str) – See COT.data_validation.NIC_TYPESRaises: ValueUnsupportedError– iftype_stringis not inSUPPORTED_NIC_TYPES
-
classmethod
validate_nic_types(type_list)[source]¶ Throw an error if any NIC type string in the list is unsupported.
Parameters: type_list (list) – See COT.data_validation.NIC_TYPESRaises: ValueUnsupportedError– if any value intype_listis not inSUPPORTED_NIC_TYPES
-
classmethod
validate_serial_count(count)[source]¶ Throw an error if the number of serial ports is not supported.
Parameters: count (int) – Number of serial ports.
Raises: ValueTooLowError– ifcountis less than the minimum required by this platformValueTooHighError– ifcountis more than the maximum supported by this platform
-
BOOTSTRAP_DISK_TYPE= 'cdrom'¶
-
CONFIG_TEXT_FILE= 'config.txt'¶
-
LITERAL_CLI_STRING= 'config'¶
-
PLATFORM_NAME= '(unrecognized platform, generic)'¶
-
SECONDARY_CONFIG_TEXT_FILE= None¶
-
SUPPORTED_NIC_TYPES= ['E1000e', 'E1000', 'PCNet32', 'virtio', 'VMXNET3']¶
-
classmethod