diff options
| author | Ewan Mellor <ewan.mellor@citrix.com> | 2010-07-24 02:49:20 +0100 |
|---|---|---|
| committer | Ewan Mellor <ewan.mellor@citrix.com> | 2010-07-24 02:49:20 +0100 |
| commit | effbd4b4c7077043c0ff2ddcb91607b4e79796f6 (patch) | |
| tree | a9a4c628533c64211b349c9c3d713ddd9b113c8f /nova/virt | |
| parent | 1046fd21fad35fdb9922f667017937ec94774498 (diff) | |
| parent | 809a1fe80b9922a36c64bce948588a5797cae87b (diff) | |
Merged with trunk, since a lot of useful things have gone in there recently.
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/images.py | 14 | ||||
| -rw-r--r-- | nova/virt/libvirt_conn.py | 19 |
2 files changed, 16 insertions, 17 deletions
diff --git a/nova/virt/images.py b/nova/virt/images.py index 0b11c134e..fd74349b1 100644 --- a/nova/virt/images.py +++ b/nova/virt/images.py @@ -31,22 +31,20 @@ flags.DEFINE_bool('use_s3', True, 'whether to get images from s3 or use local copy') -def fetch(pool, image, path): +def fetch(image, path): if FLAGS.use_s3: f = _fetch_s3_image else: f = _fetch_local_image - return f(pool, image, path) + return f(image, path) -def _fetch_s3_image(pool, image, path): +def _fetch_s3_image(image, path): url = _image_url('%s/image' % image) - d = pool.simpleExecute('curl --silent %s -o %s' % (url, path)) - return d + return process.simple_execute('curl --silent %s -o %s' % (url, path)) -def _fetch_local_image(pool, image, path): +def _fetch_local_image(image, path): source = _image_path('%s/image' % image) - d = pool.simpleExecute('cp %s %s' % (source, path)) - return d + return process.simple_execute('cp %s %s' % (source, path)) def _image_path(path): return os.path.join(FLAGS.images_path, path) diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index 74fec650e..39ed9bd78 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -175,8 +175,8 @@ class LibvirtConnection(object): basepath = lambda x='': self.basepath(instance, x) # ensure directories exist and are writable - yield self._pool.simpleExecute('mkdir -p %s' % basepath()) - yield self._pool.simpleExecute('chmod 0777 %s' % basepath()) + yield process.simple_execute('mkdir -p %s' % basepath()) + yield process.simple_execute('chmod 0777 %s' % basepath()) # TODO(termie): these are blocking calls, it would be great @@ -187,15 +187,16 @@ class LibvirtConnection(object): f.close() if not os.path.exists(basepath('disk')): - yield images.fetch(self._pool, data['image_id'], basepath('disk-raw')) + yield images.fetch(data['image_id'], basepath('disk-raw')) if not os.path.exists(basepath('kernel')): - yield images.fetch(self._pool, data['kernel_id'], basepath('kernel')) + yield images.fetch(data['kernel_id'], basepath('kernel')) if not os.path.exists(basepath('ramdisk')): - yield images.fetch(self._pool, data['ramdisk_id'], basepath('ramdisk')) + yield images.fetch(data['ramdisk_id'], basepath('ramdisk')) - execute = lambda cmd, input=None: self._pool.simpleExecute(cmd=cmd, - input=input, - error_ok=1) + execute = lambda cmd, input=None: \ + process.simple_execute(cmd=cmd, + input=input, + error_ok=1) key = data['key_data'] net = None @@ -212,7 +213,7 @@ class LibvirtConnection(object): yield disk.inject_data(basepath('disk-raw'), key, net, execute=execute) if os.path.exists(basepath('disk')): - yield self._pool.simpleExecute('rm -f %s' % basepath('disk')) + yield process.simple_execute('rm -f %s' % basepath('disk')) bytes = (instance_types.INSTANCE_TYPES[data['instance_type']]['local_gb'] * 1024 * 1024 * 1024) |
