[openstack-nova/el6] update to Essex-rc1

Pádraig Brady pbrady at fedoraproject.org
Tue Apr 17 22:56:04 UTC 2012


commit f7e4a12405bead659797e5c7d13188028ce7bbca
Author: Pádraig Brady <P at draigBrady.com>
Date:   Mon Apr 2 00:52:27 2012 +0100

    update to Essex-rc1

 .gitignore                                         |    1 +
 ...fix-X-Server-Management-Url-for-v1.0-noau.patch |   44 -
 ...e-don-t-access-the-net-when-building-docs.patch |    4 +-
 ...hain-rule-for-EC2-metadata-requests-lp-85.patch |   37 -
 0002-fix-useexisting-deprecation-warnings.patch    |   49 +
 ...pi-add-the-INPUT-rule-for-EC2-metadata-lp.patch |  185 ----
 ...tomic-manipulation-of-libvirt-disk-images.patch |  218 ++++
 ...d-validation-for-OSAPI-server-name-length.patch |   88 ++
 ...ser-to-choose-either-ietadm-or-tgtadm-lp-.patch |  233 -----
 ...e-VolumeDriver.sync_exec-method-lp-819997.patch |  233 -----
 ...tadm-tgtadm-calls-out-into-helper-classes.patch |  558 ----------
 ...tgtadm-off-by-one-error.-Fixes-bug-871278.patch |   35 -
 ...57-abstract-out-disk-image-access-methods.patch | 1080 --------------------
 ...7-support-handling-images-with-libguestfs.patch |  155 ---
 ...estfs-operation-with-specified-partitions.patch |   40 -
 ...d-validation-for-OSAPI-server-name-length.patch |   65 --
 nova-sudoers                                       |   45 +-
 nova.conf                                          |   31 +-
 openstack-nova-cert.init                           |  102 ++
 openstack-nova-newdeps.patch                       |    7 +-
 openstack-nova.spec                                |   97 +-
 sources                                            |    2 +-
 22 files changed, 537 insertions(+), 2772 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f15aacf..ef5e79e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 /nova-2011.3.1~20120117.10818.tar.gz
 /nova-2011.3.1.tar.gz
+/nova-2012.1~rc1.tar.gz
diff --git a/0011-Ensure-we-don-t-access-the-net-when-building-docs.patch b/0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
similarity index 92%
rename from 0011-Ensure-we-don-t-access-the-net-when-building-docs.patch
rename to 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
index 7a175b1..e1cb7e9 100644
--- a/0011-Ensure-we-don-t-access-the-net-when-building-docs.patch
+++ b/0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
@@ -1,4 +1,4 @@
-From 3588ad017f290892ddbf56a124926076edee4e79 Mon Sep 17 00:00:00 2001
+From 77af841f5a2e249b4ede21f393b5464b8b750226 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady at redhat.com>
 Date: Fri, 6 Jan 2012 12:16:34 +0000
 Subject: [PATCH] Ensure we don't access the net when building docs
@@ -11,7 +11,7 @@ Change-Id: I9d02fb4053a8106672aded1614a2850e21603eb2
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/doc/source/conf.py b/doc/source/conf.py
-index 996dfb0..f62ebf8 100644
+index 8ced294..7df59cd 100644
 --- a/doc/source/conf.py
 +++ b/doc/source/conf.py
 @@ -25,7 +25,7 @@ sys.path.insert(0, os.path.abspath('./'))
diff --git a/0002-fix-useexisting-deprecation-warnings.patch b/0002-fix-useexisting-deprecation-warnings.patch
new file mode 100644
index 0000000..806a0ed
--- /dev/null
+++ b/0002-fix-useexisting-deprecation-warnings.patch
@@ -0,0 +1,49 @@
+From 6054e7206bea118b400fe2571c8b23888bb6387a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady at redhat.com>
+Date: Thu, 8 Mar 2012 16:32:30 +0000
+Subject: [PATCH] fix useexisting deprecation warnings
+
+Fixes deprecation warnings when using sqlalchemy >= 0.7.0
+Fixes bug 941951
+
+Change-Id: Iaa57153f99c60c67a14c1dca849188937bdc5dee
+---
+ .../075_convert_bw_usage_to_store_network_id.py    |    4 ++--
+ .../versions/081_drop_instance_id_bw_cache.py      |    2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/nova/db/sqlalchemy/migrate_repo/versions/075_convert_bw_usage_to_store_network_id.py b/nova/db/sqlalchemy/migrate_repo/versions/075_convert_bw_usage_to_store_network_id.py
+index b275524..4ff3d99 100644
+--- a/nova/db/sqlalchemy/migrate_repo/versions/075_convert_bw_usage_to_store_network_id.py
++++ b/nova/db/sqlalchemy/migrate_repo/versions/075_convert_bw_usage_to_store_network_id.py
+@@ -46,7 +46,7 @@ def upgrade(migrate_engine):
+                 Column('last_refreshed', DateTime(timezone=False)),
+                 Column('bw_in', BigInteger()),
+                 Column('bw_out', BigInteger()),
+-                useexisting=True)
++                extend_existing=True)
+     mac_column = Column('mac', String(255))
+     bw_usage_cache.create_column(mac_column)
+ 
+@@ -81,7 +81,7 @@ def downgrade(migrate_engine):
+                 Column('last_refreshed', DateTime(timezone=False)),
+                 Column('bw_in', BigInteger()),
+                 Column('bw_out', BigInteger()),
+-                useexisting=True)
++                extend_existing=True)
+ 
+     network_label_column = Column('network_label', String(255))
+     bw_usage_cache.create_column(network_label_column)
+diff --git a/nova/db/sqlalchemy/migrate_repo/versions/081_drop_instance_id_bw_cache.py b/nova/db/sqlalchemy/migrate_repo/versions/081_drop_instance_id_bw_cache.py
+index c6687ac..a607ed3 100644
+--- a/nova/db/sqlalchemy/migrate_repo/versions/081_drop_instance_id_bw_cache.py
++++ b/nova/db/sqlalchemy/migrate_repo/versions/081_drop_instance_id_bw_cache.py
+@@ -37,7 +37,7 @@ def upgrade(migrate_engine):
+         Column('last_refreshed', DateTime(timezone=False)),
+         Column('bw_in', BigInteger()),
+         Column('bw_out', BigInteger()),
+-        useexisting=True)
++        extend_existing=True)
+ 
+     bw_usage_cache.drop_column('instance_id')
+ 
diff --git a/0003-ensure-atomic-manipulation-of-libvirt-disk-images.patch b/0003-ensure-atomic-manipulation-of-libvirt-disk-images.patch
new file mode 100644
index 0000000..14046bd
--- /dev/null
+++ b/0003-ensure-atomic-manipulation-of-libvirt-disk-images.patch
@@ -0,0 +1,218 @@
+From 0ce9eb5dabd84f7566d54ad5c16b807d73c9274d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?P=C3=A1draig=20Brady?= <pbrady at redhat.com>
+Date: Fri, 16 Mar 2012 03:43:49 +0000
+Subject: [PATCH] ensure atomic manipulation of libvirt disk images
+
+This pattern could probably be used elsewhere,
+but only libvirt disk images are considered for now.
+This change ensures there are no stale files left
+anywhere in the path from glance, through the libvirt image cache.
+These could cause subsequent operational errors either
+directly or indirectly through disk wastage.
+
+* nova/utils.py: Add a new remove_on_error() context manager
+that is used to remove the passed PATH on a raised exception.
+* nova/virt/images.py: Ensure temporary downloaded and
+converted images are protected.
+* nova/virt/libvirt/connection.py: Ensure all the images in
+the image cache and instance dirs are protected.
+
+Change-Id: I81a5407665a6998128c0dee41387ef00ebddeb4d
+---
+ nova/utils.py                   |   21 +++++++++--
+ nova/virt/images.py             |   69 +++++++++++++++++----------------------
+ nova/virt/libvirt/connection.py |   16 ++++++---
+ 3 files changed, 57 insertions(+), 49 deletions(-)
+
+diff --git a/nova/utils.py b/nova/utils.py
+index ef2b329..6b3ca10 100644
+--- a/nova/utils.py
++++ b/nova/utils.py
+@@ -21,6 +21,7 @@
+ 
+ import contextlib
+ import datetime
++import errno
+ import functools
+ import hashlib
+ import inspect
+@@ -1013,8 +1014,8 @@ def cleanup_file_locks():
+             continue
+         try:
+             stat_info = os.stat(os.path.join(FLAGS.lock_path, filename))
+-        except OSError as (errno, strerror):
+-            if errno == 2:  # doesn't exist
++        except OSError as e:
++            if e.errno == errno.ENOENT:
+                 continue
+             else:
+                 raise
+@@ -1033,8 +1034,8 @@ def delete_if_exists(pathname):
+ 
+     try:
+         os.unlink(pathname)
+-    except OSError as (errno, strerror):
+-        if errno == 2:  # doesn't exist
++    except OSError as e:
++        if e.errno == errno.ENOENT:
+             return
+         else:
+             raise
+@@ -1340,6 +1341,18 @@ def logging_error(message):
+             LOG.exception(message)
+ 
+ 
++ at contextlib.contextmanager
++def remove_on_error(path):
++    """Protect code that wants to operate on PATH atomically.
++    Any exception will cause PATH to be removed.
++    """
++    try:
++        yield
++    except Exception:
++        with save_and_reraise_exception():
++            delete_if_exists(path)
++
++
+ def make_dev_path(dev, partition=None, base='/dev'):
+     """Return a path to a particular device.
+ 
+diff --git a/nova/virt/images.py b/nova/virt/images.py
+index 1e0ae0a..2c0b12c 100644
+--- a/nova/virt/images.py
++++ b/nova/virt/images.py
+@@ -51,18 +51,10 @@ def fetch(context, image_href, path, _user_id, _project_id):
+     #             checked before we got here.
+     (image_service, image_id) = nova.image.get_image_service(context,
+                                                              image_href)
+-    try:
++    with utils.remove_on_error(path):
+         with open(path, "wb") as image_file:
+             metadata = image_service.get(context, image_id, image_file)
+-    except Exception:
+-        with utils.save_and_reraise_exception():
+-            try:
+-                os.unlink(path)
+-            except OSError, e:
+-                if e.errno != errno.ENOENT:
+-                    LOG.warn("unable to remove stale image '%s': %s" %
+-                             (path, e.strerror))
+-    return metadata
++            return metadata
+ 
+ 
+ def fetch_to_raw(context, image_href, path, user_id, project_id):
+@@ -85,37 +77,36 @@ def fetch_to_raw(context, image_href, path, user_id, project_id):
+ 
+         return(data)
+ 
+-    data = _qemu_img_info(path_tmp)
+-
+-    fmt = data.get("file format")
+-    if fmt is None:
+-        os.unlink(path_tmp)
+-        raise exception.ImageUnacceptable(
+-            reason=_("'qemu-img info' parsing failed."), image_id=image_href)
+-
+-    if "backing file" in data:
+-        backing_file = data['backing file']
+-        os.unlink(path_tmp)
+-        raise exception.ImageUnacceptable(image_id=image_href,
+-            reason=_("fmt=%(fmt)s backed by: %(backing_file)s") % locals())
+-
+-    if fmt != "raw" and FLAGS.force_raw_images:
+-        staged = "%s.converted" % path
+-        LOG.debug("%s was %s, converting to raw" % (image_href, fmt))
+-        out, err = utils.execute('qemu-img', 'convert', '-O', 'raw',
+-                                 path_tmp, staged)
+-        os.unlink(path_tmp)
+-
+-        data = _qemu_img_info(staged)
+-        if data.get('file format', None) != "raw":
+-            os.unlink(staged)
++    with utils.remove_on_error(path_tmp):
++        data = _qemu_img_info(path_tmp)
++
++        fmt = data.get("file format")
++        if fmt is None:
++            raise exception.ImageUnacceptable(
++                reason=_("'qemu-img info' parsing failed."),
++                image_id=image_href)
++
++        if "backing file" in data:
++            backing_file = data['backing file']
+             raise exception.ImageUnacceptable(image_id=image_href,
+-                reason=_("Converted to raw, but format is now %s") %
+-                data.get('file format', None))
++                reason=_("fmt=%(fmt)s backed by: %(backing_file)s") % locals())
++
++        if fmt != "raw" and FLAGS.force_raw_images:
++            staged = "%s.converted" % path
++            LOG.debug("%s was %s, converting to raw" % (image_href, fmt))
++            with utils.remove_on_error(staged):
++                out, err = utils.execute('qemu-img', 'convert', '-O', 'raw',
++                                         path_tmp, staged)
++
++                data = _qemu_img_info(staged)
++                if data.get('file format', None) != "raw":
++                    raise exception.ImageUnacceptable(image_id=image_href,
++                        reason=_("Converted to raw, but format is now %s") %
++                        data.get('file format', None))
+ 
+-        os.rename(staged, path)
++                os.rename(staged, path)
+ 
+-    else:
+-        os.rename(path_tmp, path)
++        else:
++            os.rename(path_tmp, path)
+ 
+     return metadata
+diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
+index 3aabfde..ea94e1e 100644
+--- a/nova/virt/libvirt/connection.py
++++ b/nova/virt/libvirt/connection.py
+@@ -1028,7 +1028,8 @@ class LibvirtConnection(driver.ComputeDriver):
+             @utils.synchronized(fname)
+             def call_if_not_exists(base, fn, *args, **kwargs):
+                 if not os.path.exists(base):
+-                    fn(target=base, *args, **kwargs)
++                    with utils.remove_on_error(base):
++                        fn(target=base, *args, **kwargs)
+ 
+             if cow or not generating:
+                 call_if_not_exists(base, fn, *args, **kwargs)
+@@ -1044,8 +1045,9 @@ class LibvirtConnection(driver.ComputeDriver):
+                         size_gb = size / (1024 * 1024 * 1024)
+                         cow_base += "_%d" % size_gb
+                         if not os.path.exists(cow_base):
+-                            libvirt_utils.copy_image(base, cow_base)
+-                            disk.extend(cow_base, size)
++                            with utils.remove_on_error(cow_base):
++                                libvirt_utils.copy_image(base, cow_base)
++                                disk.extend(cow_base, size)
+                     libvirt_utils.create_cow_image(cow_base, target)
+                 elif not generating:
+                     libvirt_utils.copy_image(base, target)
+@@ -1055,7 +1057,8 @@ class LibvirtConnection(driver.ComputeDriver):
+                     if size:
+                         disk.extend(target, size)
+ 
+-            copy_and_extend(cow, generating, base, target, size)
++            with utils.remove_on_error(target):
++                copy_and_extend(cow, generating, base, target, size)
+ 
+     @staticmethod
+     def _create_local(target, local_size, unit='G',
+@@ -1215,8 +1218,9 @@ class LibvirtConnection(driver.ComputeDriver):
+                               project_id=instance['project_id'],)
+         elif config_drive:
+             label = 'config'
+-            self._create_local(basepath('disk.config'), 64, unit='M',
+-                               fs_format='msdos', label=label)  # 64MB
++            with utils.remove_on_error(basepath('disk.config')):
++                self._create_local(basepath('disk.config'), 64, unit='M',
++                                   fs_format='msdos', label=label)  # 64MB
+ 
+         if instance['key_data']:
+             key = str(instance['key_data'])
diff --git a/0004-Add-validation-for-OSAPI-server-name-length.patch b/0004-Add-validation-for-OSAPI-server-name-length.patch
new file mode 100644
index 0000000..e34f0e8
--- /dev/null
+++ b/0004-Add-validation-for-OSAPI-server-name-length.patch
@@ -0,0 +1,88 @@
+From d4a0a4c35ab5da866ec75404551793f0952f85d5 Mon Sep 17 00:00:00 2001
+From: Dan Prince <dprince at redhat.com>
+Date: Fri, 23 Mar 2012 15:03:19 -0400
+Subject: [PATCH] Add validation for OSAPI server name length.
+
+Fixes LP Bug #962515.
+
+Change-Id: Iee895604f8e9101a341a5909fc5ba2dd8e708b4b
+---
+ nova/api/openstack/compute/servers.py            |    4 ++
+ nova/tests/api/openstack/compute/test_servers.py |   42 ++++++++++++++++++++++
+ 2 files changed, 46 insertions(+), 0 deletions(-)
+
+diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
+index e6a8fdc..8ca49b6 100644
+--- a/nova/api/openstack/compute/servers.py
++++ b/nova/api/openstack/compute/servers.py
+@@ -505,6 +505,10 @@ class Controller(wsgi.Controller):
+             msg = _("Server name is an empty string")
+             raise exc.HTTPBadRequest(explanation=msg)
+ 
++        if not len(value) < 256:
++            msg = _("Server name must be less than 256 characters.")
++            raise exc.HTTPBadRequest(explanation=msg)
++
+     def _get_injected_files(self, personality):
+         """
+         Create a list of injected files from the personality attribute
+diff --git a/nova/tests/api/openstack/compute/test_servers.py b/nova/tests/api/openstack/compute/test_servers.py
+index 59d7c8a..238afa3 100644
+--- a/nova/tests/api/openstack/compute/test_servers.py
++++ b/nova/tests/api/openstack/compute/test_servers.py
+@@ -891,6 +891,17 @@ class ServersControllerTest(test.TestCase):
+         self.assertEqual(res_dict['server']['id'], FAKE_UUID)
+         self.assertEqual(res_dict['server']['name'], 'server_test')
+ 
++    def test_update_server_name_too_long(self):
++        self.stubs.Set(nova.db, 'instance_get',
++                fakes.fake_instance_get(name='server_test'))
++        req = fakes.HTTPRequest.blank('/v2/fake/servers/%s' % FAKE_UUID)
++        req.method = 'PUT'
++        req.content_type = 'application/json'
++        body = {'server': {'name': 'x' * 256}}
++        req.body = json.dumps(body)
++        self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update,
++                            req, FAKE_UUID, body)
++
+     def test_update_server_access_ipv4(self):
+         self.stubs.Set(nova.db, 'instance_get',
+                 fakes.fake_instance_get(access_ipv4='0.0.0.0'))
+@@ -1643,6 +1654,37 @@ class ServersControllerCreateTest(test.TestCase):
+         self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
+                             req, body)
+ 
++    def test_create_instance_name_too_long(self):
++        # proper local hrefs must start with 'http://localhost/v2/'
++        image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
++        image_href = 'http://localhost/v2/images/%s' % image_uuid
++        flavor_ref = 'http://localhost/123/flavors/3'
++        body = {
++            'server': {
++                'name': 'X' * 256,
++                'imageRef': image_href,
++                'flavorRef': flavor_ref,
++                'metadata': {
++                    'hello': 'world',
++                    'open': 'stack',
++                },
++                'personality': [
++                    {
++                        "path": "/etc/banner.txt",
++                        "contents": "MQ==",
++                    },
++
++                ],
++            },
++        }
++
++        req = fakes.HTTPRequest.blank('/v2/fake/servers')
++        req.method = 'POST'
++        req.body = json.dumps(body)
++        req.headers["content-type"] = "application/json"
++        self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
++                            req, body)
++
+     def test_create_instance(self):
+         # proper local hrefs must start with 'http://localhost/v2/'
+         image_uuid = '76fa36fc-c930-4bf3-8c8a-ea2a2420deb6'
diff --git a/nova-sudoers b/nova-sudoers
index 41c5d67..2292d36 100644
--- a/nova-sudoers
+++ b/nova-sudoers
@@ -1,46 +1,3 @@
 Defaults:nova !requiretty
 
-Cmnd_Alias NOVACMDS = /bin/aoe-stat,                            \
-                      /bin/chmod,                               \
-                      /bin/chmod /var/lib/nova/tmp/*/root/.ssh, \
-                      /bin/chown,                               \
-                      /bin/chown /var/lib/nova/tmp/*/root/.ssh, \
-                      /bin/dd,                                  \
-                      /bin/kill,                                \
-                      /bin/mkdir,                               \
-                      /bin/mount,                               \
-                      /bin/umount,                              \
-                      /sbin/aoe-discover,                       \
-                      /sbin/ifconfig,                           \
-                      /sbin/ip,                                 \
-                      /sbin/ip6tables-restore,                  \
-                      /sbin/ip6tables-save,                     \
-                      /sbin/iptables,                           \
-                      /sbin/iptables-restore,                   \
-                      /sbin/iptables-save,                      \
-                      /sbin/iscsiadm,                           \
-                      /sbin/kpartx,                             \
-                      /sbin/losetup,                            \
-                      /sbin/lvcreate,                           \
-                      /sbin/lvdisplay,                          \
-                      /sbin/lvremove,                           \
-                      /sbin/pvcreate,                           \
-                      /sbin/route,                              \
-                      /sbin/tune2fs,                            \
-                      /sbin/vconfig,                            \
-                      /sbin/vgcreate,                           \
-                      /sbin/vgs,                                \
-                      /usr/bin/fusermount,                      \
-                      /usr/bin/guestmount,                      \
-                      /usr/bin/socat,                           \
-                      /usr/bin/tee,                             \
-        		      /usr/bin/qemu-nbd,            			\
-                      /usr/bin/virsh,                           \
-                      /usr/sbin/brctl,                          \
-                      /usr/sbin/dnsmasq,                        \
-                      /usr/sbin/ietadm,		            		\
-                      /usr/sbin/radvd,                          \
-                      /usr/sbin/tgtadm,                         \
-                      /usr/sbin/vblade-persist
-
-nova ALL = (root) NOPASSWD: SETENV: NOVACMDS
+nova ALL = (root) NOPASSWD: SETENV: /usr/bin/nova-rootwrap
diff --git a/nova.conf b/nova.conf
index b647725..7cb9931 100644
--- a/nova.conf
+++ b/nova.conf
@@ -1,12 +1,19 @@
---logdir=/var/log/nova
---state_path=/var/lib/nova
---lock_path=/var/lib/nova/tmp
---dhcpbridge=/usr/bin/nova-dhcpbridge
---dhcpbridge_flagfile=/etc/nova/nova.conf
---injected_network_template=/usr/share/nova/interfaces.template
---libvirt_xml_template=/usr/share/nova/libvirt.xml.template
---vpn_client_template=/usr/share/nova/client.ovpn.template
---credentials_template=/usr/share/nova/novarc.template
---network_manager=nova.network.manager.FlatDHCPManager
---iscsi_helper=tgtadm
---sql_connection=mysql://nova:nova@localhost/nova
+[DEFAULT]
+logdir = /var/log/nova
+state_path = /var/lib/nova
+lock_path = /var/lib/nova/tmp
+dhcpbridge = /usr/bin/nova-dhcpbridge
+dhcpbridge_flagfile = /etc/nova/nova.conf
+force_dhcp_release = True
+injected_network_template = /usr/share/nova/interfaces.template
+libvirt_xml_template = /usr/share/nova/libvirt.xml.template
+libvirt_nonblocking = True
+vpn_client_template = /usr/share/nova/client.ovpn.template
+credentials_template = /usr/share/nova/novarc.template
+network_manager = nova.network.manager.FlatDHCPManager
+iscsi_helper = tgtadm
+sql_connection = mysql://nova:nova@localhost/nova
+connection_type = libvirt
+firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
+rpc_backend = nova.rpc.impl_qpid
+root_helper = sudo nova-rootwrap
diff --git a/openstack-nova-cert.init b/openstack-nova-cert.init
new file mode 100644
index 0000000..ebb64ad
--- /dev/null
+++ b/openstack-nova-cert.init
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# openstack-nova-cert  OpenStack Nova cert Worker
+#
+# chkconfig:   - 20 80
+# description: cert manages auth cert access and creation
+
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
+# Short-Description: OpenStack Nova Cert Manager
+# Description: cert manages auth cert access and creation
+### END INIT INFO
+
+. /etc/rc.d/init.d/functions
+
+suffix=cert
+prog=openstack-nova-$suffix
+exec="/usr/bin/nova-$suffix"
+config="/etc/nova/nova.conf"
+pidfile="/var/run/nova/nova-$suffix.pid"
+logfile="/var/log/nova/$suffix.log"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile=/var/lock/subsys/$prog
+
+start() {
+    [ -x $exec ] || exit 5
+    [ -f $config ] || exit 6
+    echo -n $"Starting $prog: "
+    daemon --user nova --pidfile $pidfile "$exec --flagfile $config --logfile $logfile &>/dev/null & echo \$! > $pidfile"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc -p $pidfile $prog
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    restart
+}
+
+force_reload() {
+    restart
+}
+
+rh_status() {
+    status -p $pidfile $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+exit $?
diff --git a/openstack-nova-newdeps.patch b/openstack-nova-newdeps.patch
index 906ba77..cc96695 100644
--- a/openstack-nova-newdeps.patch
+++ b/openstack-nova-newdeps.patch
@@ -1,5 +1,6 @@
---- nova-2011.3.orig/nova/__init__.py	2011-11-24 12:44:24.681458224 +0000
-+++ nova-2011.3/nova/__init__.py	2011-11-24 13:20:00.567485395 +0000
+diff -Naur nova-2012.1.orig/nova/__init__.py nova-2012.1/nova/__init__.py
+--- nova-2012.1.orig/nova/__init__.py	2012-04-02 00:45:02.505117835 +0000
++++ nova-2012.1/nova/__init__.py	2012-04-02 00:47:49.348207780 +0000
 @@ -31,6 +31,29 @@
  .. moduleauthor:: Andy Smith <andy at anarkystic.com>
  """
@@ -28,5 +29,5 @@
 +
 +
  import gettext
- 
+ import logging
  
diff --git a/openstack-nova.spec b/openstack-nova.spec
index f3b922e..01dab69 100644
--- a/openstack-nova.spec
+++ b/openstack-nova.spec
@@ -1,25 +1,28 @@
 %global with_doc %{!?_without_doc:1}%{?_without_doc:0}
 
 Name:             openstack-nova
-Version:          2011.3.1
-Release:          8%{?dist}
+Version:          2012.1
+# The Release is in form 0.X.tag as per:
+#   http://fedoraproject.org/wiki/Packaging:NamingGuidelines#Pre-Release_packages
+# So for prereleases always increment X
+Release:          0.1.rc1%{?dist}
 Summary:          OpenStack Compute (nova)
 
 Group:            Applications/System
 License:          ASL 2.0
 URL:              http://openstack.org/projects/compute/
-Source0:          http://launchpad.net/nova/diablo/%{version}/+download/nova-%{version}.tar.gz
+Source0:          http://launchpad.net/nova/essex/essex-rc1/+download/nova-%{version}~rc1.tar.gz
 Source1:          nova.conf
 Source6:          nova.logrotate
 
-Source11:         openstack-nova-api.init
+Source10:         openstack-nova-api.init
+Source11:         openstack-nova-cert.init
 Source12:         openstack-nova-compute.init
 Source13:         openstack-nova-network.init
 Source14:         openstack-nova-objectstore.init
 Source15:         openstack-nova-scheduler.init
 Source16:         openstack-nova-volume.init
 Source17:         openstack-nova-direct-api.init
-Source18:         openstack-nova-ajax-console-proxy.init
 Source19:         openstack-nova-vncproxy.init
 
 Source20:         nova-sudoers
@@ -28,20 +31,12 @@ Source22:         nova-ifc-template
 Source23:         openstack-nova-db-setup
 
 #
-# patches_base=2011.3.1
+# patches_base=essex-rc1
 #
-Patch0001: 0001-Bug-920497-fix-X-Server-Management-Url-for-v1.0-noau.patch
-Patch0002: 0002-Add-INPUT-chain-rule-for-EC2-metadata-requests-lp-85.patch
-Patch0003: 0003-Have-nova-api-add-the-INPUT-rule-for-EC2-metadata-lp.patch
-Patch0004: 0004-Allow-the-user-to-choose-either-ietadm-or-tgtadm-lp-.patch
-Patch0005: 0005-Remove-VolumeDriver.sync_exec-method-lp-819997.patch
-Patch0006: 0006-Refactor-ietadm-tgtadm-calls-out-into-helper-classes.patch
-Patch0007: 0007-Fix-tgtadm-off-by-one-error.-Fixes-bug-871278.patch
-Patch0008: 0008-Bug-898257-abstract-out-disk-image-access-methods.patch
-Patch0009: 0009-Bug-898257-support-handling-images-with-libguestfs.patch
-Patch0010: 0010-Fix-libguestfs-operation-with-specified-partitions.patch
-Patch0011: 0011-Ensure-we-don-t-access-the-net-when-building-docs.patch
-Patch0012: 0012-Add-validation-for-OSAPI-server-name-length.patch
+Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
+Patch0002: 0002-fix-useexisting-deprecation-warnings.patch
+Patch0003: 0003-ensure-atomic-manipulation-of-libvirt-disk-images.patch
+Patch0004: 0004-Add-validation-for-OSAPI-server-name-length.patch
 
 # This is EPEL specific and not upstream
 Patch100:         openstack-nova-newdeps.patch
@@ -54,13 +49,14 @@ BuildRequires:    python-netaddr
 BuildRequires:    python-lockfile
 
 Requires:         python-nova = %{version}-%{release}
-Requires:         openstack-glance
 
 Requires:         python-paste
 Requires:         python-paste-deploy
 Requires:         python-setuptools
 
 Requires:         bridge-utils
+#TODO: Enable when available in RHEL 6.3
+#Requires:         dnsmasq-utils
 Requires:         libguestfs-mount >= 1.7.17
 # The fuse dependency should be added to libguestfs-mount
 Requires:         fuse
@@ -72,7 +68,6 @@ Requires:         MySQL-python
 
 Requires:         euca2ools
 Requires:         openssl
-Requires:         rabbitmq-server
 Requires:         sudo
 
 Requires(post):   chkconfig
@@ -102,12 +97,16 @@ Requires:         libvirt-python
 Requires:         python-anyjson
 Requires:         python-IPy
 Requires:         python-boto
+# TODO: make these messaging libs optional
+Requires:         python-qpid
+Requires:         python-carrot
 Requires:         python-kombu
 Requires:         python-amqplib
 Requires:         python-daemon
 Requires:         python-eventlet
 Requires:         python-greenlet
 Requires:         python-gflags
+Requires:         python-iso8601
 Requires:         python-lockfile
 Requires:         python-lxml
 Requires:         python-mox
@@ -119,6 +118,7 @@ Requires:         python-twisted-core
 Requires:         python-twisted-web
 Requires:         python-webob1.0
 Requires:         python-netaddr
+# TODO: remove the following dependency which is minimal
 Requires:         python-glance
 Requires:         python-novaclient
 Requires:         python-paste-deploy
@@ -163,7 +163,7 @@ BuildRequires:    python-twisted-core
 BuildRequires:    python-twisted-web
 BuildRequires:    python-webob1.0
 # while not strictly required, quiets the build down when building docs.
-BuildRequires:    python-carrot, python-mox, python-suds, m2crypto, bpython, python-memcached, python-migrate
+BuildRequires:    python-carrot, python-mox, python-suds, m2crypto, bpython, python-memcached, python-migrate, python-iso8601
 
 %description      doc
 OpenStack Compute (codename Nova) is open source software designed to
@@ -180,14 +180,6 @@ This package contains documentation files for nova.
 %patch0002 -p1
 %patch0003 -p1
 %patch0004 -p1
-%patch0005 -p1
-%patch0006 -p1
-%patch0007 -p1
-%patch0008 -p1
-%patch0009 -p1
-%patch0010 -p1
-%patch0011 -p1
-%patch0012 -p1
 
 # Apply EPEL patch
 %patch100 -p1
@@ -204,18 +196,28 @@ find nova -name \*.py -exec sed -i '/\/usr\/bin\/env python/d' {} \;
 
 # docs generation requires everything to be installed first
 export PYTHONPATH="$( pwd ):$PYTHONPATH"
+
+# TODO: possibly remove call to
+# manually auto-generate to work around sphinx-build segfault
+# This was not required on python-sphinx-1.0.7 at least
+# but it's relatively quick at least
+doc/generate_autodoc_index.sh
+
 pushd doc
-# Manually auto-generate to work around sphinx-build segfault
-./generate_autodoc_index.sh
-SPHINX_DEBUG=1 sphinx-1.0-build -b man source build/man
-mkdir -p %{buildroot}%{_mandir}/man1
-install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
 
 %if 0%{?with_doc}
 SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
 # Fix hidden-file-or-dir warnings
 rm -fr build/html/.doctrees build/html/.buildinfo
 %endif
+
+# Create dir link to avoid a sphinx-build exception
+mkdir -p build/man/.doctrees/
+ln -s .  build/man/.doctrees/man
+SPHINX_DEBUG=1 sphinx-1.0-build -b man -c source source/man build/man
+mkdir -p %{buildroot}%{_mandir}/man1
+install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
+
 popd
 
 # Give stack, instance-usage-audit and clear_rabbit_queues a reasonable prefix
@@ -242,19 +244,21 @@ touch %{buildroot}%{_sharedstatedir}/nova/CA/{cacert.pem,crl.pem,index.txt,opens
 install -d -m 750 %{buildroot}%{_sharedstatedir}/nova/CA/private
 touch %{buildroot}%{_sharedstatedir}/nova/CA/private/cakey.pem
 
-# Install config file
+# Install config files
 install -d -m 755 %{buildroot}%{_sysconfdir}/nova
 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_sysconfdir}/nova/nova.conf
+install -p -D -m 640 etc/nova/api-paste.ini %{buildroot}%{_sysconfdir}/nova/api-paste.ini
+install -p -D -m 640 etc/nova/policy.json %{buildroot}%{_sysconfdir}/nova/policy.json
 
 # Install initscripts for Nova services
-install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-nova-api
+install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-nova-api
+install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-nova-cert
 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-nova-compute
 install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/openstack-nova-network
 install -p -D -m 755 %{SOURCE14} %{buildroot}%{_initrddir}/openstack-nova-objectstore
 install -p -D -m 755 %{SOURCE15} %{buildroot}%{_initrddir}/openstack-nova-scheduler
 install -p -D -m 755 %{SOURCE16} %{buildroot}%{_initrddir}/openstack-nova-volume
 install -p -D -m 755 %{SOURCE17} %{buildroot}%{_initrddir}/openstack-nova-direct-api
-install -p -D -m 755 %{SOURCE18} %{buildroot}%{_initrddir}/openstack-nova-ajax-console-proxy
 install -p -D -m 755 %{SOURCE19} %{buildroot}%{_initrddir}/openstack-nova-vncproxy
 
 # Install sudoers
@@ -279,10 +283,9 @@ install -p -D -m 644 %{SOURCE21} %{buildroot}%{_sysconfdir}/polkit-1/localauthor
 # Install database setup helper script.
 install -p -D -m 755 %{SOURCE23} %{buildroot}%{_bindir}/openstack-nova-db-setup
 
-# Remove ajaxterm and various other tools
-rm -fr %{buildroot}%{_datarootdir}/nova/{ajaxterm,euca-get-ajax-console,install_venv.py,nova-debug,pip-requires,clean-vlans,with_venv.sh,esx}
-
 # Remove unneeded in production stuff
+rm -f %{buildroot}%{_bindir}/nova-debug
+rm -fr %{buildroot}%{python_sitelib}/nova/tests/
 rm -fr %{buildroot}%{python_sitelib}/run_tests.*
 rm -f %{buildroot}%{_bindir}/nova-combined
 rm -f %{buildroot}/usr/share/doc/nova/README*
@@ -300,13 +303,13 @@ exit 0
 
 %post
 # Register the services
-for svc in api compute network objectstore scheduler volume direct-api ajax-console-proxy vncproxy; do
+for svc in api cert compute network objectstore scheduler volume direct-api vncproxy; do
     /sbin/chkconfig --add openstack-nova-${svc}
 done
 
 %preun
 if [ $1 -eq 0 ] ; then
-    for svc in api compute network objectstore scheduler volume direct-api ajax-console-proxy vncproxy; do
+    for svc in api cert compute network objectstore scheduler volume direct-api vncproxy; do
         /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
         /sbin/chkconfig --del openstack-nova-${svc}
     done
@@ -314,7 +317,7 @@ fi
 
 %postun
 if [ "$1" -ge 1 ] ; then
-    for svc in api compute network objectstore scheduler volume direct-api ajax-console-proxy vncproxy; do
+    for svc in api cert compute network objectstore scheduler volume direct-api vncproxy; do
         /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
     done
 fi
@@ -323,7 +326,8 @@ fi
 %doc LICENSE
 %dir %{_sysconfdir}/nova
 %config(noreplace) %attr(-, root, nova) %{_sysconfdir}/nova/nova.conf
-%config(noreplace) %{_sysconfdir}/nova/api-paste.ini
+%config(noreplace) %attr(-, root, nova) %{_sysconfdir}/nova/api-paste.ini
+%config(noreplace) %attr(-, root, nova) %{_sysconfdir}/nova/policy.json
 %config(noreplace) %{_sysconfdir}/logrotate.d/openstack-nova
 %config(noreplace) %{_sysconfdir}/sudoers.d/nova
 %config(noreplace) %{_sysconfdir}/polkit-1/localauthority/50-local.d/50-nova.pkla
@@ -332,8 +336,8 @@ fi
 %dir %attr(0755, nova, root) %{_localstatedir}/run/nova
 
 %{_bindir}/nova-*
-%{_initrddir}/openstack-nova-*
 %{_bindir}/openstack-nova-db-setup
+%{_initrddir}/openstack-nova-*
 %{_datarootdir}/nova
 %{_mandir}/man1/nova*.1.gz
 
@@ -374,6 +378,9 @@ fi
 %endif
 
 %changelog
+* Mon Apr 01 2012 Pádraig Brady <P at draigBrady.com> - 2012.1-0.1.rc1
+- Update to Essex release candidate 1
+
 * Thu Mar 29 2012 Pádraig Brady <P at draigBrady.com> - 2011.3.1-8
 - Remove the dependency on the not yet available dnsmasq-utils
 
diff --git a/sources b/sources
index daddc28..eaaae2c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-68c58c9f483660b7e8ab365cd312469e  nova-2011.3.1.tar.gz
+0ec5593ed39246b96fa0e5b40e01df89  nova-2012.1~rc1.tar.gz


More information about the scm-commits mailing list