Coverage for ocp_resources/virtual_machine_preference.py: 0%

47 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-30 10:48 +0200

1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md 

2 

3from typing import Any, Dict, Optional 

4from ocp_resources.resource import NamespacedResource 

5 

6 

7class VirtualMachinePreference(NamespacedResource): 

8 """ 

9 VirtualMachinePreference resource contains optional preferences related to the VirtualMachine. 

10 """ 

11 

12 api_group: str = NamespacedResource.ApiGroup.INSTANCETYPE_KUBEVIRT_IO 

13 

14 def __init__( 

15 self, 

16 spec_annotations: Optional[Dict[str, Any]] = None, 

17 clock: Optional[Dict[str, Any]] = None, 

18 cpu: Optional[Dict[str, Any]] = None, 

19 devices: Optional[Dict[str, Any]] = None, 

20 features: Optional[Dict[str, Any]] = None, 

21 firmware: Optional[Dict[str, Any]] = None, 

22 machine: Optional[Dict[str, Any]] = None, 

23 prefer_spread_socket_to_core_ratio: Optional[int] = None, 

24 preferred_subdomain: Optional[str] = "", 

25 preferred_termination_grace_period_seconds: Optional[int] = None, 

26 requirements: Optional[Dict[str, Any]] = None, 

27 volumes: Optional[Dict[str, Any]] = None, 

28 **kwargs: Any, 

29 ) -> None: 

30 """ 

31 Args: 

32 spec_annotations (Dict[str, Any]): Optionally defines preferred Annotations to be applied to the 

33 VirtualMachineInstance 

34 

35 clock (Dict[str, Any]): Clock optionally defines preferences associated with the Clock 

36 attribute of a VirtualMachineInstance DomainSpec 

37 

38 cpu (Dict[str, Any]): CPU optionally defines preferences associated with the CPU attribute 

39 of a VirtualMachineInstance DomainSpec 

40 

41 devices (Dict[str, Any]): Devices optionally defines preferences associated with the Devices 

42 attribute of a VirtualMachineInstance DomainSpec 

43 

44 features (Dict[str, Any]): Features optionally defines preferences associated with the Features 

45 attribute of a VirtualMachineInstance DomainSpec 

46 

47 firmware (Dict[str, Any]): Firmware optionally defines preferences associated with the Firmware 

48 attribute of a VirtualMachineInstance DomainSpec 

49 

50 machine (Dict[str, Any]): Machine optionally defines preferences associated with the Machine 

51 attribute of a VirtualMachineInstance DomainSpec 

52 

53 prefer_spread_socket_to_core_ratio (int): PreferSpreadSocketToCoreRatio defines the ratio to spread vCPUs 

54 between cores and sockets, it defaults to 2. 

55 

56 preferred_subdomain (str): Subdomain of the VirtualMachineInstance 

57 

58 preferred_termination_grace_period_seconds (int): Grace period observed after signalling a VirtualMachineInstance to 

59 stop after which the VirtualMachineInstance is force terminated. 

60 

61 requirements (Dict[str, Any]): Requirements defines the minium amount of instance type defined 

62 resources required by a set of preferences 

63 

64 volumes (Dict[str, Any]): Volumes optionally defines preferences associated with the Volumes 

65 attribute of a VirtualMachineInstace DomainSpec 

66 

67 """ 

68 super().__init__(**kwargs) 

69 

70 self.spec_annotations = spec_annotations 

71 self.clock = clock 

72 self.cpu = cpu 

73 self.devices = devices 

74 self.features = features 

75 self.firmware = firmware 

76 self.machine = machine 

77 self.prefer_spread_socket_to_core_ratio = prefer_spread_socket_to_core_ratio 

78 self.preferred_subdomain = preferred_subdomain 

79 self.preferred_termination_grace_period_seconds = preferred_termination_grace_period_seconds 

80 self.requirements = requirements 

81 self.volumes = volumes 

82 

83 def to_dict(self) -> None: 

84 super().to_dict() 

85 

86 if not self.kind_dict and not self.yaml_file: 

87 self.res["spec"] = {} 

88 _spec = self.res["spec"] 

89 

90 if self.spec_annotations: 

91 _spec["annotations"] = self.spec_annotations 

92 

93 if self.clock: 

94 _spec["clock"] = self.clock 

95 

96 if self.cpu: 

97 _spec["cpu"] = self.cpu 

98 

99 if self.devices: 

100 _spec["devices"] = self.devices 

101 

102 if self.features: 

103 _spec["features"] = self.features 

104 

105 if self.firmware: 

106 _spec["firmware"] = self.firmware 

107 

108 if self.machine: 

109 _spec["machine"] = self.machine 

110 

111 if self.prefer_spread_socket_to_core_ratio: 

112 _spec["preferSpreadSocketToCoreRatio"] = self.prefer_spread_socket_to_core_ratio 

113 

114 if self.preferred_subdomain: 

115 _spec["preferredSubdomain"] = self.preferred_subdomain 

116 

117 if self.preferred_termination_grace_period_seconds: 

118 _spec["preferredTerminationGracePeriodSeconds"] = self.preferred_termination_grace_period_seconds 

119 

120 if self.requirements: 

121 _spec["requirements"] = self.requirements 

122 

123 if self.volumes: 

124 _spec["volumes"] = self.volumes 

125 

126 # End of generated code