def stm_enabled(self, value): """Short Term Monitoring. Short Term metrics can affect the performance of workloads. Not recommended for production workload. """ self.set_parm_value(_STM_ENABLED, u.sanitize_bool_for_api(value))
def bld(cls, adapter, pvid, vlan_ids, vswitch, trunk_pri=1): """Create the TrunkAdapter element that can be used for SEA creation. The returned adapter uses the "next available high slot" option, meaning that the API will attempt to assign the next available slot number that's higher than all the existing assigned slot numbers. :param adapter: A pypowervm.adapter.Adapter (for traits, etc.) :param pvid: The primary VLAN ID (ex. 1) for the Network Bridge. :param vlan_ids: Additional VLAN ids for the trunk adapters. :param vswitch: The vswitch wrapper to retrieve ID and href. :param trunk_pri: Trunk priority of this adapter. Defaults to 1. :returns: A new TrunkAdapter ElementWrapper that represents the new TrunkAdapter. """ ta = super(TrunkAdapter, cls)._bld(adapter) ta._required(True) ta.pvid = pvid ta.tagged_vlans = vlan_ids ta.has_tag_support = True if vlan_ids else False ta._vswitch_id(vswitch.switch_id) ta._trunk_pri(trunk_pri) # UseNextAvailableSlotID field - High only if available unasi_field = (_TA_USE_NEXT_AVAIL_HIGH_SLOT if adapter.traits.has_high_slot else _TA_USE_NEXT_AVAIL_SLOT) ta.set_parm_value(unasi_field, u.sanitize_bool_for_api(True)) ta._associated_vswitch_uri(vswitch.related_href) return ta
def is_mover_service_partition(self, value): """Set the Mover Service Partition designation. :param value: Boolean indicating whether the VIOS should be designated as a Mover Service Partition. """ self.set_parm_value(_VIO_MVR_SVC_PARTITION, u.sanitize_bool_for_api(value))
def _use_next_avail_slot_id(self, unasi): """Use next available (high) slot ID. :param unasi: Boolean value to set (True or False) """ unasi_field = (_TA_USE_NEXT_AVAIL_HIGH_SLOT if self.traits.has_high_slot else _TA_USE_NEXT_AVAIL_SLOT) self.set_parm_value(unasi_field, u.sanitize_bool_for_api(unasi))
def required(self, val): self.set_parm_value(_IO_SLOT_REQ, u.sanitize_bool_for_api(val))
def _use_next_slot(self, use): """Use next available (not high) slot.""" self.set_parm_value(_NEXT_SLOT, u.sanitize_bool_for_api(use))
def test_sanitize_bool_for_api(self): self.assertEqual('true', util.sanitize_bool_for_api(True)) self.assertEqual('false', util.sanitize_bool_for_api(False)) self.assertEqual('true', util.sanitize_bool_for_api('True')) self.assertEqual('false', util.sanitize_bool_for_api('False'))
def tagged(self, is_tagged): self.set_parm_value(_VNET_TAG, u.sanitize_bool_for_api(is_tagged))
def has_tag_support(self, new_val): self.set_parm_value(_TA_TAG_SUPP, u.sanitize_bool_for_api(new_val))
def _is_primary(self, val): self.set_parm_value(_SEA_PRIMARY, u.sanitize_bool_for_api(val))
def _is_thin(self, val): """val is boolean.""" self.set_parm_value(_LU_THIN, u.sanitize_bool_for_api(val))
def compute_ltm_enabled(self, value): """Compute Long Term Monitoring.""" self.set_parm_value(_COMP_LTM_ENABLED, u.sanitize_bool_for_api(value))
def _failover(self, value): """Private setter for the failover attr. Determined by backing adapters on NetworkBridge creation. """ self.set_parm_value(_NB_FAILOVER, u.sanitize_bool_for_api(value))
def aggregation_enabled(self, value): """Metrics Aggregation.""" self.set_parm_value(_AGG_ENABLED, u.sanitize_bool_for_api(value))
def ltm_enabled(self, value): """Long Term Monitoring.""" self.set_parm_value(_LTM_ENABLED, u.sanitize_bool_for_api(value))
def _required(self, value): self.set_parm_value(_TA_REQUIRED, u.sanitize_bool_for_api(value))
def _has_dedicated(self, val): """Expects 'true' (string) for dedicated or 'false' for shared.""" self.set_parm_value(_PC_HAS_DED_PROCS, u.sanitize_bool_for_api(val))
def restrictedio(self, value): self.set_parm_value(_LPAR_RESTRICTED_IO, u.sanitize_bool_for_api(value))
def _bus_grp_required(self, val): self.set_parm_value(_ASSOC_IO_SLOT_BUS_GRP, u.sanitize_bool_for_api(val))
def load_balance(self, value): self.set_parm_value(_NB_LOADBALANCE, u.sanitize_bool_for_api(value))
def is_service_partition(self, value): """Set if this is the service partition.""" self.set_parm_value(_BP_SVC_PARTITION, u.sanitize_bool_for_api(value))
def rr_enabled(self, value): """Turn Remote Restart on or off. LPAR must be powered off. """ self.set_parm_value(_LPAR_RR, u.sanitize_bool_for_api(value))
def auto_pri_failover(self, val): self.set_parm_value(_VNICD_AUTO_FB, u.sanitize_bool_for_api(val))
def flow_ctl(self, val): self.set_parm_value(_SRIOVPP_CFG_FLOWCTL, u.sanitize_bool_for_api(val))
def _is_promisc(self, value): self.set_parm_value(_SRIOVLP_IS_PROMISC, u.sanitize_bool_for_api(value))
def srr_enabled(self, value): self.set_parm_value(_LPAR_SRR, u.sanitize_bool_for_api(value), attrib=pc.ATTR_KSV120)
def srr_enabled(self, value): self.set_parm_value(_LPAR_SRR, u.sanitize_bool_for_api(value), attrib=pc.ATTR_SCHEMA120)
def _use_next_slot(self, use): """Use next available (not high) slot.""" self.set_parm_value(_VADPT_NEXT_SLOT, u.sanitize_bool_for_api(use))
def is_tagged_vlan_supported(self, new_val): """Parameter new_val is a bool (True or False).""" self.set_parm_value(_VADPT_TAGGED_VLAN_SUPPORT, u.sanitize_bool_for_api(new_val))