Ejemplo n.º 1
0
    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))
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
    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
Ejemplo n.º 4
0
    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))
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
    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))
Ejemplo n.º 7
0
 def required(self, val):
     self.set_parm_value(_IO_SLOT_REQ, u.sanitize_bool_for_api(val))
Ejemplo n.º 8
0
 def _use_next_slot(self, use):
     """Use next available (not high) slot."""
     self.set_parm_value(_NEXT_SLOT, u.sanitize_bool_for_api(use))
Ejemplo n.º 9
0
 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'))
Ejemplo n.º 10
0
 def tagged(self, is_tagged):
     self.set_parm_value(_VNET_TAG, u.sanitize_bool_for_api(is_tagged))
Ejemplo n.º 11
0
 def has_tag_support(self, new_val):
     self.set_parm_value(_TA_TAG_SUPP, u.sanitize_bool_for_api(new_val))
Ejemplo n.º 12
0
 def _is_primary(self, val):
     self.set_parm_value(_SEA_PRIMARY, u.sanitize_bool_for_api(val))
Ejemplo n.º 13
0
 def _is_thin(self, val):
     """val is boolean."""
     self.set_parm_value(_LU_THIN, u.sanitize_bool_for_api(val))
Ejemplo n.º 14
0
 def compute_ltm_enabled(self, value):
     """Compute Long Term Monitoring."""
     self.set_parm_value(_COMP_LTM_ENABLED, u.sanitize_bool_for_api(value))
Ejemplo n.º 15
0
    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))
Ejemplo n.º 16
0
 def aggregation_enabled(self, value):
     """Metrics Aggregation."""
     self.set_parm_value(_AGG_ENABLED, u.sanitize_bool_for_api(value))
Ejemplo n.º 17
0
 def ltm_enabled(self, value):
     """Long Term Monitoring."""
     self.set_parm_value(_LTM_ENABLED, u.sanitize_bool_for_api(value))
Ejemplo n.º 18
0
 def tagged(self, is_tagged):
     self.set_parm_value(_VNET_TAG, u.sanitize_bool_for_api(is_tagged))
Ejemplo n.º 19
0
 def _required(self, value):
     self.set_parm_value(_TA_REQUIRED, u.sanitize_bool_for_api(value))
Ejemplo n.º 20
0
 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))
Ejemplo n.º 21
0
 def restrictedio(self, value):
     self.set_parm_value(_LPAR_RESTRICTED_IO,
                         u.sanitize_bool_for_api(value))
Ejemplo n.º 22
0
 def _bus_grp_required(self, val):
     self.set_parm_value(_ASSOC_IO_SLOT_BUS_GRP,
                         u.sanitize_bool_for_api(val))
Ejemplo n.º 23
0
 def has_tag_support(self, new_val):
     self.set_parm_value(_TA_TAG_SUPP, u.sanitize_bool_for_api(new_val))
Ejemplo n.º 24
0
 def required(self, val):
     self.set_parm_value(_IO_SLOT_REQ, u.sanitize_bool_for_api(val))
Ejemplo n.º 25
0
 def load_balance(self, value):
     self.set_parm_value(_NB_LOADBALANCE, u.sanitize_bool_for_api(value))
Ejemplo n.º 26
0
 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))
Ejemplo n.º 27
0
 def _required(self, value):
     self.set_parm_value(_TA_REQUIRED, u.sanitize_bool_for_api(value))
Ejemplo n.º 28
0
 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))
Ejemplo n.º 29
0
    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))
Ejemplo n.º 30
0
 def auto_pri_failover(self, val):
     self.set_parm_value(_VNICD_AUTO_FB, u.sanitize_bool_for_api(val))
Ejemplo n.º 31
0
 def _is_thin(self, val):
     """val is boolean."""
     self.set_parm_value(_LU_THIN, u.sanitize_bool_for_api(val))
Ejemplo n.º 32
0
 def flow_ctl(self, val):
     self.set_parm_value(_SRIOVPP_CFG_FLOWCTL, u.sanitize_bool_for_api(val))
Ejemplo n.º 33
0
 def _bus_grp_required(self, val):
     self.set_parm_value(_ASSOC_IO_SLOT_BUS_GRP,
                         u.sanitize_bool_for_api(val))
Ejemplo n.º 34
0
 def _is_promisc(self, value):
     self.set_parm_value(_SRIOVLP_IS_PROMISC,
                         u.sanitize_bool_for_api(value))
Ejemplo n.º 35
0
 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))
Ejemplo n.º 36
0
 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'))
Ejemplo n.º 37
0
 def srr_enabled(self, value):
     self.set_parm_value(_LPAR_SRR, u.sanitize_bool_for_api(value),
                         attrib=pc.ATTR_KSV120)
Ejemplo n.º 38
0
 def srr_enabled(self, value):
     self.set_parm_value(_LPAR_SRR, u.sanitize_bool_for_api(value),
                         attrib=pc.ATTR_SCHEMA120)
Ejemplo n.º 39
0
 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))
Ejemplo n.º 40
0
 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))
Ejemplo n.º 41
0
 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))
Ejemplo n.º 42
0
 def _is_primary(self, val):
     self.set_parm_value(_SEA_PRIMARY, u.sanitize_bool_for_api(val))
Ejemplo n.º 43
0
    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))
Ejemplo n.º 44
0
 def load_balance(self, value):
     self.set_parm_value(_NB_LOADBALANCE, u.sanitize_bool_for_api(value))
Ejemplo n.º 45
0
 def restrictedio(self, value):
     self.set_parm_value(_LPAR_RESTRICTED_IO,
                         u.sanitize_bool_for_api(value))
Ejemplo n.º 46
0
    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))