Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: hooks: Adding hooks for ovirt-node-upgrade
......................................................................

hooks: Adding hooks for ovirt-node-upgrade

Currently ovirt-node offers ovirt-node-upgrade tool to
upgrade node images. This patch adds the pre-upgrade
script for vdsm tasks before the upgrade.

Change-Id: I986fe6edb8f5619dcbca33cccab080245654fd02
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1079087
Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com>
---
M Makefile.am
M configure.ac
A hooks/Makefile.am
A hooks/README
A hooks/pre-upgrade/01-vdsm
M ovirt-node-plugin-vdsm.spec.in
6 files changed, 65 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node-plugin-vdsm 
refs/changes/24/28424/1

diff --git a/Makefile.am b/Makefile.am
index 55d6ff9..694d7b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,7 @@
 
 SUBDIRS = \
   conf \
+       hooks \
        src \
        recipe
 
diff --git a/configure.ac b/configure.ac
index 836cb74..e0be83f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,7 @@
                 src/Makefile
                 src/config.py
                 conf/Makefile
+                hooks/Makefile
                 recipe/Makefile
                 ovirt-node-plugin-vdsm.spec])
 AC_OUTPUT
diff --git a/hooks/Makefile.am b/hooks/Makefile.am
new file mode 100644
index 0000000..50067df
--- /dev/null
+++ b/hooks/Makefile.am
@@ -0,0 +1,22 @@
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# 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.
+
+preupgradedir = $(libexecdir)/ovirt-node/hooks/pre-upgrade
+
+dist_preupgrade_SCRIPTS = \
+       pre-upgrade/01-vdsm \
+       $(NULL)
diff --git a/hooks/README b/hooks/README
new file mode 100644
index 0000000..44108ac
--- /dev/null
+++ b/hooks/README
@@ -0,0 +1,2 @@
+For information about ovirt-node-upgrade tool, please visit:
+http://www.ovirt.org/Ovirt-node-upgrade
diff --git a/hooks/pre-upgrade/01-vdsm b/hooks/pre-upgrade/01-vdsm
new file mode 100644
index 0000000..ec724f8
--- /dev/null
+++ b/hooks/pre-upgrade/01-vdsm
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# 01-vdsm - Copyright (C) 2014 Red Hat, Inc.
+#
+# 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.
+import sys
+
+from vdsm import utils
+
+
+def main():
+
+    print("%s: Stopping vdsmd to upgrade" % sys.argv[0])
+    rc, out, err = utils.execCmd(
+        ['vdsm-tool', 'service-stop', 'vdsmd'],
+        sudo=True,
+        raw=True
+    )
+
+    sys.stdout.write(out)
+
+    if rc != 0:
+        sys.stderr.write("Failed to stop vdsdm: %s" % err)
+
+
+    return rc
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/ovirt-node-plugin-vdsm.spec.in b/ovirt-node-plugin-vdsm.spec.in
index e8d0150..85e0d4e 100644
--- a/ovirt-node-plugin-vdsm.spec.in
+++ b/ovirt-node-plugin-vdsm.spec.in
@@ -10,7 +10,7 @@
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 URL:            http://www.ovirt.org/
-Requires:       ovirt-node >= 3.0.0
+Requires:       ovirt-node >= 3.0.4
 Requires:       python
 Requires:       vdsm-reg >= 4.10.3
 Requires:       ovirt-host-deploy-offline >= 1.1.0
@@ -73,6 +73,7 @@
 
 %files
 %{python_sitelib}/ovirt/node/setup/vdsm
+%{_libexecdir}/ovirt-node/hooks/pre-upgrade/01-vdsm
 %{_sysconfdir}/ovirt-plugins.d
 
 %changelog


-- 
To view, visit http://gerrit.ovirt.org/28424
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I986fe6edb8f5619dcbca33cccab080245654fd02
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node-plugin-vdsm
Gerrit-Branch: node-3.0
Gerrit-Owner: Douglas Schilling Landgraf <dougsl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to