Add OpenStack Patching Quick Reference Guide

Change-Id: I6ea40d418f8661f426e78b8aaa33637831fd5e98
This commit is contained in:
nerminamiller 2014-01-21 14:58:55 -05:00 committed by Dmitry Borodaenko
parent 0fd428401d
commit 4d1238fd17
14 changed files with 300 additions and 1 deletions

BIN
_images/patchcommit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 KiB

View File

@ -17,5 +17,6 @@ Documentation
user-guide
reference-architecture
release-notes
openstack-patch-quick-ref
frequently-asked-questions
eula

View File

@ -0,0 +1,13 @@
.. index Table of Contents
.. toctree:: Table of Contents
:maxdepth: 2
.. include:: /pages/openstack-patch-quick-ref/0010-intro.rst
.. include:: /pages/openstack-patch-quick-ref/0020-identify-files.rst
.. include:: /pages/openstack-patch-quick-ref/0030-obtain-patch.rst
.. include:: /pages/openstack-patch-quick-ref/0040-distribute-patch.rst
.. include:: /pages/openstack-patch-quick-ref/0050-apply-patch.rst
.. include:: /pages/openstack-patch-quick-ref/0060-restart-services.rst
.. include:: /pages/openstack-patch-quick-ref/0070-rollback-patch.rst

View File

@ -38,6 +38,11 @@ The following Mirantis OpenStack documentation is available in PDF:
The Release Notes provide general information about new features,
fixed issues, and known limitations in Mirantis OpenStack |version|.
* `OpenStack Patching Quick Reference Guide <pdf/Mirantis-OpenStack-4.0-OpenStack-Patch-Quick-Ref.pdf>`_
Patching OpenStack nodes is a manual process, and this document describes the
basic steps required to patch one or more OpenStack components.
Download Mirantis OpenStack
---------------------------

View File

@ -0,0 +1,17 @@
.. index:: OpenStack-Patch Guide
.. _OS-Patch_Guide:
========================================
OpenStack Patching Quick Reference Guide
========================================
.. contents:: :local:
:depth: 3
.. include:: /pages/openstack-patch-quick-ref/0010-intro.rst
.. include:: /pages/openstack-patch-quick-ref/0020-identify-files.rst
.. include:: /pages/openstack-patch-quick-ref/0030-obtain-patch.rst
.. include:: /pages/openstack-patch-quick-ref/0040-distribute-patch.rst
.. include:: /pages/openstack-patch-quick-ref/0050-apply-patch.rst
.. include:: /pages/openstack-patch-quick-ref/0060-restart-services.rst
.. include:: /pages/openstack-patch-quick-ref/0070-rollback-patch.rst

View File

@ -0,0 +1,26 @@
.. index:: Introduction
.. _Intro:
Introduction
============
A patch file is a representation of the difference in the code between
two points in time, many times resulting from a discovered defect or
negative issue. Once you obtain and generate a patch, you can apply it
onto the previously deployed nodes within an OpenStack environment.
Currently, patching OpenStack nodes is a manual process, and this
document describes the basic steps required to patch one or more
OpenStack components. The high level sections in this guide are:
#. Identify files to be patched
#. Obtain a patch
#. Distribute a patch
#. Apply a patch
#. Restart the services
#. Roll back a patch (optional)

View File

@ -0,0 +1,17 @@
.. index:: Identify Files
.. _IdFile:
Identify files to be patched
============================
Identifying files or components to be patched usually involves investigating
change logs for new OpenStack releases or git commit messages. You can find
change logs using `OpenStack wiki search <https://wiki.openstack.org/wiki/Special:Search/ReleaseNotes>`_.
Git commit messages are available from github.com or, in a more accesible form,
on git.openstack.org. You will need to find the exact commit providing the fix
for your problem.
For example, looking at the Release Notes for the 2013.1.4 OpenStack Grizzly
bugfix update, you can drill into the `List of OpenStack Compute (Nova) bugs fixed in the 2013.1.4 release <https://launchpad.net/nova/grizzly/2013.1.4>`_ and
find that an `Incorrect host stats reported by VMware VCDriver <https://bugs.launchpad.net/bugs/1190515>`_ issue has been resolved.

View File

@ -0,0 +1,83 @@
.. index:: Obtain Patch
.. _ObtPatch:
Obtain a patch
==============
You can obtain patches in three different ways:
* In some cases, the community or an OpenStack distribution vendor supplies a pre-generated patch for download.
* For stable release bugfix updates, you can download a cumulative version of OpenStack packages that each contains the fixes for that component.
* You can also download patches from github.com, git.openstack.org (also the repository browser), and directly from local git repository. Examples of using these methods follow.
.. note:: The first two methods can only generate patches for a single commit. If you need to generate a patch from changes resulting from many commits, use the git method.
github.com method
-----------------
To generate a patch file from a github commit, simply add ``.patch`` at the
end of your commit URL.
For example, to change the following commit URL to a patch URL:
https://github.com/openstack/nova/commit/8b9f924306ffa35b2a87cd6ec5adc28159bc78c1
Type:
https://github.com/openstack/nova/commit/8b9f924306ffa35b2a87cd6ec5adc28159bc78c1.patch
git.openstack.org method
------------------------
Using the git.openstack.org web interface, find a commit. Navigate to the
"commit" tab and download the patch file named ``(patch)``.
.. image:: /_images/patchcommit.png
:align: center
:width: 100%
Local git repository method
---------------------------
First, you will need to fetch repository data `using git <http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository>`_.
Check git format-patch help for details::
$ git format-patch -h
usage: git format-patch [options] [<since> | <revision range>]
-n, --numbered use [PATCH n/m] even with a single patch
-N, --no-numbered use [PATCH] even with multiple patches
-s, --signoff add Signed-off-by:
--stdout print patches to standard out
--cover-letter generate a cover letter
--numbered-files use simple number sequence for output file names
--suffix <sfx> use <sfx> instead of '.patch'
--start-number <n> start numbering patches at <n> instead of 1
Suppose you want to generate a patch from the last 10 commits. Use the following
command starting from most recent commit in your local repo::
$ git format-patch -10 HEAD --stdout > 0001-last-10-commits.patch
A sample patch follows:
+++ contex.py 2014-01-07 12:26:14.793787101 +0000
--- /usr/share/pyshared/nova/context.py 2013-10-17 14:15:04.000000000 +0000
@@ -21,6 +21,7 @@
import copy
import uuid
+import time
from nova import exception
from nova.openstack.common.gettextutils import _
+++ baserpc.py 2014-01-07 12:29:57.513881636 +0000
--- /usr/share/pyshared/nova/baserpc.py 2013-10-17 14:15:04.000000000 +0000
@@ -40,6 +40,7 @@
1.0 - Initial version.
1.1 - Add get_backdoor_port
+ 1.2 - New version
"""

View File

@ -0,0 +1,13 @@
.. index:: Distribute Patch
.. _DistPatch:
Distribute a patch
==================
Regardless of the method used to obtain the patch, after you download
the patch, transfer the patch to every node in the OpenStack environment
where you want to apply the fix. The simplest way to do this is to use ssh.
For example::
$ scp file01.patch node1:/tmp

View File

@ -0,0 +1,47 @@
.. index:: Apply Patch
.. _ApplyPatch:
Apply a patch
==============
To apply the fix, first change the directory to the one that
corresponds to your operating system. The OpenStack source code
(.py) files are stored in different locations depending on the
operating system:
* **Centos**: /usr/lib/python2.6/site-packages/[component] (for example, /usr/lib/python2.6/site-packages/nova)
* **Ubuntu**: /usr/share/pyshared/[component] (for example, /usr/share/pyshared/nova)
To be able to roll back the patch process in the case of a problem,
you can use the ``-b`` flag to create a backup file (.orig) in the
destination directory, back up the entire OpenStack environment
using other means like enterprise backup systems, or simply create
a local copy using your operating system commands.
Once you create a backup (or use the ``-b`` option), run the patch utility.
The patch utility will ask which file to patch. In the following example,
were patching nova.::
# patch -b < /tmp/001-nova-contex.py.patch
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|+++ contex.py 2014-01-07 12:26:14.793787101 +0000
|--- /usr/share/pyshared/nova/context.py 2013-10-17 14:15:04.000000000 +0000
--------------------------
File to patch: /usr/share/pyshared/nova/context.py
patching file /usr/share/pyshared/nova/context.py
can't find file to patch at input line 13
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|+++ baserpc.py 2014-01-07 12:29:57.513881636 +0000
|--- /usr/share/pyshared/nova/baserpc.py 2013-10-17 14:15:04.000000000 +0000
--------------------------
File to patch: /usr/share/pyshared/nova/baserpc.py
patching file /usr/share/pyshared/nova/baserpc.py
.. note:: Ignore the message “cant find file to patch at input line XX”. The reason it occurs is that the patch is not aware of the filesystem layout.

View File

@ -0,0 +1,18 @@
.. index:: Restart Services
.. _RestartSvc:
Restart the services
====================
Once the files are patched, restart all appropriate OpenStack services.
If you patch nova, for example, restart all nova services running on a
given host with the following commands::
$ service openstack-nova-api restart
$ service openstack-nova-scheduler restart
$ service openstack-nova-conductor restart
At this point, all of your services should be back up and running. You
can now perform your sanity or functional tests against the patched
environment to confirm that it is working as expected.

View File

@ -0,0 +1,30 @@
.. index:: Rollback Patch
.. _RollbackPatch:
Roll back a patch
=================
You can roll back a patch by simply reinstalling your files from the backup
or, if you chose the ``-b`` option, by using the patch commands ``-R`` flag. Again,
please ignore the missing file errors.::
# patch -R < /tmp/001-nova-contex.py.patch
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|+++ contex.py 2014-01-07 12:26:14.793787101 +0000
|--- /usr/share/pyshared/nova/context.py 2013-10-17 14:15:04.000000000 +0000
--------------------------
File to patch: /usr/share/pyshared/nova/context.py
patching file /usr/share/pyshared/nova/context.py
can't find file to patch at input line 13
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|+++ baserpc.py 2014-01-07 12:29:57.513881636 +0000
|--- /usr/share/pyshared/nova/baserpc.py 2013-10-17 14:15:04.000000000 +0000
--------------------------
File to patch: /usr/share/pyshared/nova/baserpc.py
patching file /usr/share/pyshared/nova/baserpc.py

View File

@ -21,6 +21,7 @@ pdf_documents = [
u'2013, Mirantis Inc.'),
('pdf/pdf_install', u'Mirantis-OpenStack-4.0-InstallGuide', u'Installation Guide', u'2013, Mirantis Inc.'),
('pdf/pdf_reference', u'Mirantis-OpenStack-4.0-ReferenceArchitecture', u'Reference Architecture', u'2013, Mirantis Inc.'),
('pdf/pdf_preinstall', u'Mirantis-OpenStack-4.0-Pre-InstallationGuide', u'Pre-Installation Guide', u'2013, Mirantis Inc.')
('pdf/pdf_preinstall', u'Mirantis-OpenStack-4.0-Pre-InstallationGuide', u'Pre-Installation Guide', u'2013, Mirantis Inc.'),
('pdf/pdf_patch', u'Mirantis-OpenStack-4.0-OpenStack-Patch-Quick-Ref', u'OpenStack Patching Quick Reference Guide', u'2014, Mirantis Inc.')
# (master_doc, project, project, copyright),
]

28
pdf/pdf_patch.rst Normal file
View File

@ -0,0 +1,28 @@
.. header::
.. cssclass:: header-table
+-------------------------------------+-----------------------------------+
| Mirantis OpenStack v4.0 | .. cssclass:: right|
| | |
| OpenStack Patching Quick Reference | ###Section### |
+-------------------------------------+-----------------------------------+
.. footer::
.. cssclass:: footer-table
+--------------------------+----------------------+
| | .. cssclass:: right|
| | |
| ©2014, Mirantis Inc. | Page ###Page### |
+--------------------------+----------------------+
.. raw:: pdf
PageBreak oneColumn
.. toctree:: Table of Contents
:maxdepth: 2
.. include:: ../contents/contents-openstack-patch-quick-ref.rst