Merge ~jslarraz/ubuntu-qa-tools:minor-fixes into ubuntu-qa-tools:master

Proposed by Jorge Sancho Larraz
Status: Merged
Merged at revision: 1ecb4ceb258f28499f4ea4bd246c9a38aed7a9de
Proposed branch: ~jslarraz/ubuntu-qa-tools:minor-fixes
Merge into: ubuntu-qa-tools:master
Diff against target: 64 lines (+9/-7)
1 file modified
vm-tools/uvt (+9/-7)
Reviewer Review Type Date Requested Status
Marc Deslauriers Approve
Review via email: mp+460670@code.launchpad.net

Commit message

uvt: minor fixes

Description of the change

Several minor fixes and improvements

To post a comment you must log in.
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/vm-tools/uvt b/vm-tools/uvt
2index c7b0143..6fa1ab6 100755
3--- a/vm-tools/uvt
4+++ b/vm-tools/uvt
5@@ -1439,6 +1439,7 @@ def vm_run_command(vm_name, command, root=False, start=False,
6 if quiet:
7 ssh_command += ['-q']
8 ssh_command += ['-o', 'BatchMode=yes']
9+ ssh_command += ['-i', uvt_conf['vm_ssh_key'].split(".pub")[0]]
10
11 ssh_command += [dns_name, command]
12
13@@ -1651,7 +1652,8 @@ def create_vm(release_iso, vm_name, arch, bridge, release, release_num, vnc,
14 '''Creates a new vm with virt-install'''
15
16 # https://launchpad.net/bugs/1827512
17- rc, out = runcmd(['virsh', 'capabilities'])
18+ rc, out = runcmd(['virsh', "--connect", uvt_conf["vm_connect"],
19+ 'capabilities'])
20 if rc != 0:
21 print("ERROR: problem running 'virsh capabilities':\n%s" % out,
22 file=sys.stderr)
23@@ -1696,7 +1698,7 @@ def create_vm(release_iso, vm_name, arch, bridge, release, release_num, vnc,
24 vm_net = get_vm_net(release_num)
25
26 args = [ 'virt-install',
27- '--connect=qemu:///system',
28+ '--connect=' + uvt_conf["vm_connect"],
29 '--name=' + vm_name,
30 '--arch=' + virtinst_arch,
31 '--cpu=host-passthrough',
32@@ -3078,9 +3080,9 @@ def runcmd(command, input = None, stderr = subprocess.STDOUT,
33 return [127, str(e)]
34
35 out = sp.communicate(input)[0]
36- if out:
37+ if out is not None:
38 out = out.decode()
39- return [sp.returncode,out]
40+ return [sp.returncode, out]
41
42 def get_gpg_public_key(keyid=None):
43 # try one specified in config file
44@@ -3313,6 +3315,7 @@ def check_required_tools():
45 tools = { 'virt-install' : 'virtinst',
46 'xorriso' : 'xorriso',
47 'mkisofs' : 'genisoimage',
48+ 'qemu-img' : 'qemu-utils',
49 'virsh' : 'libvirt-clients',
50 'virt-clone' : 'virtinst',
51 'virt-viewer' : 'virt-viewer',
52@@ -3404,10 +3407,9 @@ def load_uvt_config():
53
54 keyboard = parse_config_file('/etc/default/keyboard')
55
56- # Replace $HOME variable to be compatible with old shell vm-new
57+ # Replace environment variables to be compatible with old shell vm-new
58 for k in config:
59- if "$HOME" in config[k]:
60- config[k] = re.sub("\$HOME", os.path.expanduser("~"), config[k])
61+ config[k] = os.path.expandvars(config[k])
62
63 # Set default directories
64 if config.get('vm_dir_iso', "") == "":

Subscribers

People subscribed via source and target branches