Sandro Bonazzola has uploaded a new change for review. Change subject: packaging: setup: set cluster level CPU id ......................................................................
packaging: setup: set cluster level CPU id Set CPU cluster compatibility to the same CPU family chosen for hosted engine VM. Change-Id: I141304606f4a1f11bb0f9fda8b1c822669d560c8 Bug-Url: https://bugzilla.redhat.com/1034821 Signed-off-by: Sandro Bonazzola <sbona...@redhat.com> --- M src/ovirt_hosted_engine_setup/constants.py M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py M src/plugins/ovirt-hosted-engine-setup/vdsmd/cpu.py 3 files changed, 38 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/29/22129/1 diff --git a/src/ovirt_hosted_engine_setup/constants.py b/src/ovirt_hosted_engine_setup/constants.py index e0b2f08..db0eff5 100644 --- a/src/ovirt_hosted_engine_setup/constants.py +++ b/src/ovirt_hosted_engine_setup/constants.py @@ -487,6 +487,7 @@ def VDSM_CPU(self): return 'OVEHOSTED_VDSM/cpu' + ENGINE_CPU = 'OVEHOSTED_VDSM/engineCpu' USE_SSL = 'OVEHOSTED_VDSM/useSSL' diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py index e8d975b..27c657d 100644 --- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py +++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py @@ -383,7 +383,6 @@ ], ca_file=self.cert, ) - self.logger.debug('Adding the host to the cluster') engine_api.hosts.add( self._ovirtsdk_xml.params.Host( name=self.environment[ @@ -401,6 +400,7 @@ override_iptables=True, ) ) + except ovirtsdk.infrastructure.errors.RequestError as e: self.logger.debug( 'Cannot add the host to the Default cluster', @@ -428,6 +428,28 @@ ], ) ) + else: + self.logger.debug('Setting CPU for the cluster') + try: + cluster = engine_api.clusters.get('Default') + self.logger.debug(cluster.__dict__) + cpu = cluster.get_cpu() + self.logger.debug(cpu.__dict__) + cpu.set_id(self.environment[ohostedcons.VDSMEnv.ENGINE_CPU]) + cluster.set_cpu(cpu) + except ovirtsdk.infrastructure.errors.RequestError as e: + self.logger.debug( + 'Cannot set the CPU level to the Default cluster', + exc_info=True, + ) + self.logger.error( + _( + 'Cannot automatically set the CPU ' + 'to the Default cluster:\n{details}\n' + ).format( + details=e.detail + ) + ) engine_api.disconnect() @plugin.event( diff --git a/src/plugins/ovirt-hosted-engine-setup/vdsmd/cpu.py b/src/plugins/ovirt-hosted-engine-setup/vdsmd/cpu.py index c400eaa..89ffa84 100644 --- a/src/plugins/ovirt-hosted-engine-setup/vdsmd/cpu.py +++ b/src/plugins/ovirt-hosted-engine-setup/vdsmd/cpu.py @@ -84,6 +84,10 @@ ohostedcons.VDSMEnv.VDSM_CPU, None ) + self.environment.setdefault( + ohostedcons.VDSMEnv.ENGINE_CPU, + None + ) @plugin.event( stage=plugin.Stages.STAGE_SETUP, @@ -186,6 +190,16 @@ ], ) ) + for entry in self.CPU_FAMILIES: + if ( + entry['model'] == self.environment[ + ohostedcons.VDSMEnv.VDSM_CPU + ] + ): + self.environment[ + ohostedcons.VDSMEnv.ENGINE_CPU + ] = entry['name'] + break # vim: expandtab tabstop=4 shiftwidth=4 -- To view, visit http://gerrit.ovirt.org/22129 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I141304606f4a1f11bb0f9fda8b1c822669d560c8 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-setup Gerrit-Branch: master Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches