diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-16 20:46:15 +0000 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2010-07-16 20:46:15 +0000 |
| commit | c0437edb3fa7fef892aa43b749398bf0fd1ee3e7 (patch) | |
| tree | eb474c77d752ce99f61dda6bf926f5991226642b | |
| parent | 049f27d00900f4b6e810d35f8e0e1ec3520d053b (diff) | |
| parent | 52f0ec017c04ad9356eb45d96bcab90a0807d914 (diff) | |
| download | nova-c0437edb3fa7fef892aa43b749398bf0fd1ee3e7.tar.gz nova-c0437edb3fa7fef892aa43b749398bf0fd1ee3e7.tar.xz nova-c0437edb3fa7fef892aa43b749398bf0fd1ee3e7.zip | |
merge extra singleton-pool changes
| -rw-r--r-- | nova/compute/node.py | 12 | ||||
| -rw-r--r-- | nova/process.py | 3 |
2 files changed, 9 insertions, 6 deletions
diff --git a/nova/compute/node.py b/nova/compute/node.py index 3e39e65fc..8874ef17e 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -450,13 +450,13 @@ class Instance(object): def _fetch_s3_image(self, image, path): url = _image_url('%s/image' % image) - d = process.SharedPool().simple_execute( + d = process.simple_execute( 'curl --silent %s -o %s' % (url, path)) return d def _fetch_local_image(self, image, path): source = _image_path('%s/image' % image) - d = process.SharedPool().simple_execute('cp %s %s' % (source, path)) + d = process.simple_execute('cp %s %s' % (source, path)) return d @defer.inlineCallbacks @@ -466,9 +466,9 @@ class Instance(object): basepath = self.basepath # ensure directories exist and are writable - yield process.SharedPool().simple_execute( + yield process.simple_execute( 'mkdir -p %s' % basepath()) - yield process.SharedPool().simple_execute( + yield process.simple_execute( 'chmod 0777 %s' % basepath()) @@ -496,7 +496,7 @@ class Instance(object): yield _fetch_file(data['ramdisk_id'], basepath('ramdisk')) execute = lambda cmd, input=None: \ - process.SharedPool().simple_execute(cmd=cmd, + process.simple_execute(cmd=cmd, input=input, error_ok=1) @@ -515,7 +515,7 @@ class Instance(object): yield disk.inject_data(basepath('disk-raw'), key, net, execute=execute) if os.path.exists(basepath('disk')): - yield process.SharedPool().simple_execute( + yield process.simple_execute( 'rm -f %s' % basepath('disk')) bytes = (INSTANCE_TYPES[data['instance_type']]['local_gb'] diff --git a/nova/process.py b/nova/process.py index ebfb2f4ba..d3558ed2e 100644 --- a/nova/process.py +++ b/nova/process.py @@ -212,3 +212,6 @@ class SharedPool(ProcessPool): cls._instance = super(SharedPool, cls).__new__( cls, *args, **kwargs) return cls._instance + +def simple_execute(cmd, **kwargs): + return SharedPool().simple_execute(cmd, **kwargs) |
