diff options
| author | Eric Windisch <eric@cloudscaling.com> | 2011-03-09 14:31:23 -0500 |
|---|---|---|
| committer | Eric Windisch <eric@cloudscaling.com> | 2011-03-09 14:31:23 -0500 |
| commit | 23369a63f4b74fb64bf57554a3fd8b15e3e2b49c (patch) | |
| tree | 5f14103510373937a82b4395188a1d53a2c8c0cf /nova/virt | |
| parent | 1d7358e70379607c9cce02307f4336efbd135a5d (diff) | |
| download | nova-23369a63f4b74fb64bf57554a3fd8b15e3e2b49c.tar.gz nova-23369a63f4b74fb64bf57554a3fd8b15e3e2b49c.tar.xz nova-23369a63f4b74fb64bf57554a3fd8b15e3e2b49c.zip | |
Fixes uses of process_input
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/disk.py | 4 | ||||
| -rw-r--r-- | nova/virt/libvirt_conn.py | 11 |
2 files changed, 6 insertions, 9 deletions
diff --git a/nova/virt/disk.py b/nova/virt/disk.py index 203517275..a54cda003 100644 --- a/nova/virt/disk.py +++ b/nova/virt/disk.py @@ -175,8 +175,8 @@ def _inject_key_into_fs(key, fs): utils.execute('sudo', 'chown', 'root', sshdir) utils.execute('sudo', 'chmod', '700', sshdir) keyfile = os.path.join(sshdir, 'authorized_keys') - # TODO:EWINDISCH: not sure about the following /w execv patch - utils.execute('sudo', 'tee', '-a', keyfile, '\n' + key.strip() + '\n') + utils.execute('sudo', 'tee', '-a', keyfile, + process_input='\n' + key.strip() + '\n') def _inject_net_into_fs(net, fs): diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index 76f31f91a..6b555ecbb 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -485,13 +485,10 @@ class LibvirtConnection(object): port = random.randint(int(start_port), int(end_port)) # netcat will exit with 0 only if the port is in use, # so a nonzero return value implies it is unused - - # TODO(ewindisch): broken /w execvp patch. - # subprocess lets us do this, but utils.execute - # abstracts it away from us - cmd = 'netcat', '0.0.0.0', port, '-w', '1', '</dev/null || echo free' % (port) - stdout, stderr = utils.execute(cmd) - if stdout.strip() == 'free': + cmd = 'netcat', '0.0.0.0', port, '-w', '1' + try: + stdout, stderr = utils.execute(*cmd, process_input='') + except ProcessExecutionError: return port raise Exception(_('Unable to find an open port')) |
