Skip to content

Instantly share code, notes, and snippets.

@markmc
markmc / PowerShellVmsResource.java
Created Feb 22, 2011
New getProcess() method
View PowerShellVmsResource.java
class PowerShellVmsResource {
enum Method { GET, ADD };
enum Detail { DISKS, STATISTICS };
static String getProcess(Method method, Set<Detail> details) {
StringBuilder buf = new StringBuilder();
if (details != null) {
if (details.contains(Detail.DISKS)) {
buf.append(GET_STATS);
@markmc
markmc / gist:988981
Created May 24, 2011
Minimal AS7 modules
View gist:988981
<modules>
<module>build</module>
<module>build-config</module>
<module>controller</module>
<module>controller-client</module>
<module>deployment-repository</module>
<module>deployment-scanner</module>
<module>domain-controller</module>
<module>domain-http-api</module>
<module>ee</module>
@markmc
markmc / gist:988985
Created May 24, 2011
Minimal AS7 deps analysis
View gist:988985
basic deps:
junit:junit:jar:4.8.1:test
core jboss bits with no deps:
org.jboss.logging:jboss-logging:jar:3.0.0.Beta3:compile
org.jboss.modules:jboss-modules:jar:1.0.0.Beta17:compile
org.jboss.msc:jboss-msc:jar:1.0.0.Beta8:compile
@markmc
markmc / gist:1000672
Created May 31, 2011
Image Factory Console Hack Hack
View gist:1000672
diff --git a/services/image_factory/console/lib/image_factory/image_factory_console.rb b/services/image_factory/console/lib/image_factory/image_factory_console.rb
index c196632..788d86f 100644
--- a/services/image_factory/console/lib/image_factory/image_factory_console.rb
+++ b/services/image_factory/console/lib/image_factory/image_factory_console.rb
@@ -65,8 +65,8 @@ class ImageFactoryConsole < Qmf2::ConsoleHandler
# TODO: return error if there is a problem calling this method or getting
# a factory instance
begin
- response = factory.image(descriptor, target)
- build_adaptor(response)
@markmc
markmc / gist:4488261
Created Jan 8, 2013
LazyPluggable and config groups
View gist:4488261
diff --git a/nova/utils.py b/nova/utils.py
index 30e2d80..c73af06 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, **backends, config_group=None):
View gist:4488277
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):
View gist:4682108
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:
@markmc
markmc / gist:5466295
Created Apr 26, 2013
Splitting baremetal
View gist:5466295
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
@markmc
markmc / gist:5500967
Created May 2, 2013
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
View gist:5500967
--- 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)