Joey Boggs has uploaded a new change for review. Change subject: [DRAFT] add hosted-engine support ......................................................................
[DRAFT] add hosted-engine support This adds a plugin subpackage for the hosted engine and dependencies there are still some setup issues to debug within the persisted node environment that will continue to be picked up in F20 to finish Documenting a few things for later reference: - bridge setup intermittent failures in ovirt-hosted-engine-setup second attempt passes - after install the node gets rebooted, possibly fenced? - network / libvirt / vdsm configs need to be persisted - on reboot, the storage domain need to be manually setup After the reboot here are steps to get vm back running - vdsm-tool configure --force (persisted files should fix this) - hosted-engine --connect-storage - hosted-engine --start-pool - hosted-engine --vm-start - vdsClient -s localhost list Once done the vm should launch however it's not able to communicate with the bridge or external network Change-Id: I602266200b2f062fe299de5329987c85f2494512 Signed-off-by: Joey Boggs <[email protected]> --- M ovirt-node.spec.in M src/Makefile.am A src/ovirt/node/setup/hosted-engine/__init__.py A src/ovirt/node/setup/hosted-engine/hosted_engine_page.py 4 files changed, 184 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/01/26201/1 diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in index 970eef3..aa8b155 100644 --- a/ovirt-node.spec.in +++ b/ovirt-node.spec.in @@ -244,6 +244,17 @@ #cleanup tmp directory from cim setup rm -rf /tmp/cim_schema* +%package plugin-hosted-engine +Summary: Hosted Engine plugin for %{product_family} image +Group: Applications/System +Requires: ovirt-hosted-engine-setup +Requires: screen + +%description plugin-hosted-engine +This package provides a hosted engine plugin for use with%{product_family} image. + +#%post plugin-hosted-engine +#%files plugin-hosted-engine # # SELinux subpackage @@ -588,6 +599,9 @@ %doc semodule/*.fc semodule/*.te %{_datadir}/selinux/*/%{selinux_modulename}.pp +%files plugin-hosted-engine +%{python_sitelib}/ovirt/node/setup/hosted-engine/__init__.py* +%{python_sitelib}/ovirt/node/setup/hosted-engine/hosted_engine_page.py* %files %defattr(-,root,root) diff --git a/src/Makefile.am b/src/Makefile.am index 959ac23..2856b67 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -71,6 +71,7 @@ pyovirt_node_setup_snmpdir = $(pyovirt_node_setupdir)/snmp pyovirt_node_setup_puppetdir = $(pyovirt_node_setupdir)/puppet pyovirt_node_setup_ipmidir = $(pyovirt_node_setupdir)/ipmi +pyovirt_node_setup_hostedenginedir = $(pyovirt_node_setupdir)/hosted-engine pyovirt_PYTHON = \ @@ -202,3 +203,8 @@ pyovirt_node_setup_ipmi_PYTHON = \ ovirt/node/setup/ipmi/__init__.py \ ovirt/node/setup/ipmi/ipmi_page.py + +# Setup Hosted Engine Plugin +pyovirt_node_setup_hostedengine_PYTHON = \ + ovirt/node/setup/hosted-engine/__init__.py \ + ovirt/node/setup/hosted-engine/hosted_engine_page.py diff --git a/src/ovirt/node/setup/hosted-engine/__init__.py b/src/ovirt/node/setup/hosted-engine/__init__.py new file mode 100644 index 0000000..710aa7d --- /dev/null +++ b/src/ovirt/node/setup/hosted-engine/__init__.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# __init__.py - Copyright (C) 2014 Red Hat, Inc. +# Written by Joey Boggs <[email protected]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. +#from ovirt.node.utils.expose import Feature, Owner +import hosted_engine_page + +""" +Hosted Engine Plugin +""" + + +def createPlugins(application): + hosted_engine_page.Plugin(application) + + +def createPluginFeatures(application): + application.register(Feature(owner=Owner(name=__package__), + name="hosted-engine", + description="Hosted Engine setup")) diff --git a/src/ovirt/node/setup/hosted-engine/hosted_engine_page.py b/src/ovirt/node/setup/hosted-engine/hosted_engine_page.py new file mode 100644 index 0000000..f148bb5 --- /dev/null +++ b/src/ovirt/node/setup/hosted-engine/hosted_engine_page.py @@ -0,0 +1,128 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# +# hosted_engine_page.py - Copyright (C) 2014 Red Hat, Inc. +# Written by Joey Boggs <[email protected]> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. A copy of the GNU General Public License is +# also available at http://www.gnu.org/copyleft/gpl.html. + +from ovirt.node import plugins, ui, utils +from ovirt.node.plugins import Changeset +from ovirt_hosted_engine_ha.client import client +import os + +VM_CONF_PATH = "/etc/ovirt-hosted-engine/vm.conf" +""" +Configure Hosted Engine +""" + + +class Plugin(plugins.NodePlugin): + _server = None + + def name(self): + return "Hosted Engine" + + def rank(self): + return 110 + + def model(self): + conf_status = os.path.exists(VM_CONF_PATH) + vm = None + if conf_status: + with open(VM_CONF_PATH) as f: + for line in f: + if "vmName" in line: + vm = line.strip().split("=")[1] + + ha_cli = client.HAClient() + try: + vm_status = ha_cli.get_all_host_stats() + except: + vm_status = "Cannot connect to HA daemon, please check the logs" + + model = { + "hosted_engine.enabled": str(conf_status), + "hosted_engine.vm": vm, + "hosted_engine.status": str(vm_status)} + return model + + def validators(self): + return {} + + def ui_content(self): + ws = [ui.Header("header[0]", "Hosted Engine Setup"), + ui.KeywordLabel("hosted_engine.enabled", + ("Hosted Engine: ")), + ui.KeywordLabel("hosted_engine.vm", + ("Engine VM: ")), + ui.Divider("divider[0]"), + ui.KeywordLabel("hosted_engine.status", + ("Engine Status: ")), + + ui.Divider("divider[0]") + ] + + page = ui.Page("page", ws) + page.buttons = [ui.Button("action.setupengine", + "Setup Hosted Engine") + ] + self.widgets.add(page) + return page + + def on_change(self, changes): + pass + + def on_merge(self, effective_changes): + self.logger.info("Saving Hosted Engine Config") + changes = Changeset(self.pending_changes(False)) + effective_model = Changeset(self.model()) + effective_model.update(effective_changes) + + self.logger.debug("Changes: %s" % changes) + self.logger.debug("Effective Model: %s" % effective_model) + + if effective_changes.contains_any(["action.setupengine"]): + self.logger.debug("Starting drop to setup") + utils.console.writeln("Beginning Hosted Engine Setup ...") + + def open_console(): + utils.process.call("reset; screen ovirt-hosted-engine-setup", + shell=True) + + def return_ok(dialog, changes): + with self.application.ui.suspended(): + open_console() + + try: + txt = "Setup will be ran with screen enabled that can be " + txt += "reconnected in the event of a timeout or connection " + txt += "failure.\n" + txt += "\nIt can be reconnected by running 'screen -d -r'" + + dialog = ui.ConfirmationDialog("dialog.shell", + "Begin Hosted Engine Setup", txt + ) + + dialog.buttons[0].on_activate.clear() + dialog.buttons[0].on_activate.connect(ui.CloseAction()) + dialog.buttons[0].on_activate.connect(return_ok) + self.application.show(dialog) + + except: + # Error when the UI is not running + open_console() + return self.ui_content() -- To view, visit http://gerrit.ovirt.org/26201 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I602266200b2f062fe299de5329987c85f2494512 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Joey Boggs <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
