Skip to content

Instantly share code, notes, and snippets.

View markmc's full-sized avatar

Mark McLoughlin markmc

View GitHub Profile

devtest_overcloud

  1. Create your overcloud control plane image. This is the image the undercloud will deploy to become the KVM (or QEMU, Xen, etc.) cloud control plane. Note that stackuser is only there for debugging support - it is not suitable for a production network. $OVERCLOUD_DIB_EXTRA_ARGS is meant to be used to pass additional build-time specific arguments to disk-image-create. :
import socket
class ImageDownloadFailure(Exception):
def __init__(self, host, port, path, error):
self.host = host
self.port = port
self.path = path
msg = ('Failed to download %(path)s from %(host)s:%(port)s: %(error)s'
% {'host': host, 'port': port, 'path': path, 'error': error})
(py27)[markmc@sorcha oslo.config]$ cat t.py
from oslo.config import cfg
cfg.CONF.register_opt(cfg.StrOpt('connection',
deprecated_name='sql_connection'),
group='database')
cfg.CONF()
@markmc
markmc / client.py
Created May 31, 2013 15:07
Playing with kombu and async processing
import kombu.connection
import kombu.entity
import kombu.messaging
params = {
'hostname': 'localhost',
'port': 5672,
'virtual_host': '/',
}
@markmc
markmc / gist:5546607
Created May 9, 2013 09:46
nova review stats for the past 90 days using https://github.com/russellb/openstack-stats
Reviews for the last 90 days in nova
** -- nova-core team member
+--------------------------+-----------------------------------+
| Reviewer | Reviews (-2|-1|+1|+2) (+/- ratio) |
+--------------------------+-----------------------------------+
| russellb ** | 493 (57|124|8|304) (63.3%) |
| mikalstill ** | 393 (6|53|4|330) (85.0%) |
| vishvananda ** | 359 (7|28|3|321) (90.3%) |
| klmitch ** | 299 (1|43|0|255) (85.3%) |
| sdague ** | 277 (13|65|7|192) (71.8%) |
@markmc
markmc / gist:5500967
Created May 2, 2013 08:40
Patch to python 2.7 subprocess.py to show demonstrate what RHEL6 python 2.6 is doing. See https://bitbucket.org/eventlet/eventlet/pull-request/30/add-dummy-timeout-parameter-to
--- subprocess.py.pristine 2013-05-02 09:32:32.314673712 +0100
+++ subprocess.py 2013-05-02 09:35:50.284568183 +0100
@@ -490,7 +490,7 @@
retcode = call(["ls", "-l"])
"""
- return Popen(*popenargs, **kwargs).wait()
+ return Popen(*popenargs, **kwargs).wait(timeout=None)
@markmc
markmc / gist:5466295
Created April 26, 2013 10:16
Splitting baremetal
class BareMetalNode(object):
(SHUTDOWN, RUNNING) = range(2)
(BUILDING, ACTIVE, ERROR, DELETED) = range(1)
def __init__(self, **kwargs):
self._name = kwargs.get('name')
self._memory_mb = kwargs['memory_mb']
self._cpus_mb = kwargs['cpus']
...
self._state = None
CONF.register_opt(StrOpt('root_helper'))
CONF.register_opt(StrOpt('root_helper'), group='agent')
def get_root_helper():
root_helper = CONF.agent.root_helper
if root_helper is not None:
return root_helper
root_helper = CONF.root_helper:
diff --git a/nova/utils.py b/nova/utils.py
index 30e2d80..55921b8 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -507,14 +507,18 @@ def str_dict_replace(s, mapping):
class LazyPluggable(object):
"""A pluggable backend loaded lazily based on some value."""
- def __init__(self, pivot, **backends):
+ def __init__(self, pivot, config_group=None, **backends):