Exemplo n.º 1
0
 def build_entity(self):
     return otypes.Host(
         name=self.param('name'),
         cluster=otypes.Cluster(
             name=self.param('cluster')) if self.param('cluster') else None,
         comment=self.param('comment'),
         address=self.param('address'),
         root_password=self.param('password'),
         ssh=otypes.Ssh(authentication_method=otypes.SshAuthenticationMethod
                        .PUBLICKEY, ) if self.param('public_key') else None,
         spm=otypes.Spm(priority=self.param('spm_priority'), )
         if self.param('spm_priority') else None,
         override_iptables=self.param('override_iptables'),
         display=otypes.Display(address=self.param('override_display'), )
         if self.param('override_display') else None,
         os=otypes.OperatingSystem(custom_kernel_cmdline=' '.join(
             self.param('kernel_params')), )
         if self.param('kernel_params') else None,
         power_management=otypes.PowerManagement(
             enabled=self.param('power_management_enabled'),
             kdump_detection=self.param('kdump_integration') == 'enabled',
         ) if self.param('power_management_enabled') is not None
         or self.param('kdump_integration') else None,
     )
Exemplo n.º 2
0
 def build_entity(self):
     return otypes.Host(power_management=otypes.PowerManagement(
         enabled=True, ), )
Exemplo n.º 3
0
            types.Option(
                name='myname',
                value='myvalue',
            ),
        ],
        order=0,
    ))

# Prepare the update host object:
host_update = types.Host()

# If power management isn't enabled, enable it. Note that
# power management can be enabled only if at least one fence
# agent exists for host:
if not host.power_management.enabled:
    host_update.power_management = types.PowerManagement(enabled=True)

# If kdump isn't enabled, enable it. Note that kdump
# can be enabled only if power management on the host
# is enabled:
kdump_enabled = False
if not host.power_management.kdump_detection:
    kdump_enabled = True
    host_update.power_management.kdump_detection = True

# Send the update request:
host_service.update(host_update)

# Note that after kdump integration is enabled the host must be
# reinstalled so the kdump will take effect. First we need to
# switch host to maintenance, because host must be in maintenance