Improve --libvirt default experience
ClosedPublic

Authored by jskladan on Mar 14 2016, 9:44 AM.

Details

Summary

Set force_imageurl to True by default. And added instructions
on using disposable clients (via --libvirt) to the readme.

File-name convetions for base images in imagesdir are described
both in config, and code.

Test Plan

Unit tests run OK

Diff Detail

Repository
rLTRN libtaskotron
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jskladan retitled this revision from to Improve --libvirt default experience.Mar 14 2016, 9:44 AM
jskladan updated this object.
jskladan edited the test plan for this revision. (Show Details)
jskladan added a reviewer: libtaskotron.
kparal added a subscriber: kparal.Mar 14 2016, 12:27 PM

I just found out that the original code from 3ba67bd98ce didn't work at all, it crashed like this:

[libtaskotron] 11:39:02 ERROR   Was expecting to find instance taskotron-20160314_113902_585744 but it does not already exist
Traceback (most recent call last):
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/minion.py", line 213, in execute
    task_vm.teardown()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/ext/disposable/vm.py", line 187, in teardown
    tc_instance = self._check_existing_instance(should_exist=True)
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/ext/disposable/vm.py", line 109, in _check_existing_instance
    " already exist".format(self.instancename))
TaskotronRemoteError: Was expecting to find instance taskotron-20160314_113902_585744 but it does not already exist
[libtaskotron] 11:39:02 CRITICAL Traceback (most recent call last):
  File "/home/kparal/devel/taskotron/env_taskotron/bin/runtask", line 9, in <module>
    load_entry_point('libtaskotron==0.4.4', 'console_scripts', 'runtask')()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/main.py", line 163, in main
    overlord.start()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/overlord.py", line 93, in start
    runner.execute()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/minion.py", line 186, in execute
    task_vm.prepare()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/ext/disposable/vm.py", line 123, in prepare
    tc_image = self._prepare_image()
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/ext/disposable/vm.py", line 70, in _prepare_image
    arch=config.get_config().disposable_arch
  File "/home/kparal/devel/taskotron/libtaskotron/libtaskotron/ext/disposable/vm.py", line 234, in get_latest
    return "file://" + os.path.join(imagesdir, latest_metadata['filename'])
  File "/home/kparal/devel/taskotron/env_taskotron/lib64/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

It no longer crashes now, but can you please check the problem has really been fixed and will not appear at some other time? (include unit tests if possible, thanks)

conf/taskotron.yaml.example
120

Could we please go back to YYYYMMDD, unless there's a strong opposition? I listed the reasons in https://phab.qadevel.cloud.fedoraproject.org/rLTRN3ba67bd98cec29303bb10d2ea873ce044318f962 .

libtaskotron/ext/disposable/vm.py
54–55

This debug printout is confusing, because it claims it will download an image even if we later decide we will not download it, but use ImageFinder instead. Move it into the if clause?

66

Another debug printout here would also be nice, so that we know which image got picked.

readme.rst
160–161

Maybe also add this?

If you store these images in ``/var/lib/taskotron/images``, adhere to their naming conventions 
and set ``force_imageurl=False`` in ``taskotron.yaml``, we will find the latest one available
automatically for you and you don't need to update the ``imageurl`` option regularly.
jskladan added inline comments.Mar 14 2016, 1:51 PM
conf/taskotron.yaml.example
120

Nope, sorry, too much hassle, especially during freeze, as this also needs changes in the scripts around imagefactory. I'll create a ticket for it though

libtaskotron/ext/disposable/vm.py
66

I'll just move the first one, it will then work as expected

readme.rst
160–161

Sounds good.

kparal requested changes to this revision.Mar 14 2016, 3:02 PM
kparal added a reviewer: kparal.

Looks good, just the one variable needs correcting.

libtaskotron/ext/disposable/vm.py
71

Doesn't work, because you're using img_url, but printing self.imageurl. The latter one doesn't seem to be used anywhere else, just erase it into oblivion?

readme.rst
150
`Setting up Testcloud`_ section

will make a hyperlink and nicely format it

This revision now requires changes to proceed.Mar 14 2016, 3:02 PM
jskladan added inline comments.Mar 14 2016, 3:26 PM
libtaskotron/ext/disposable/vm.py
71

that's what I get for doing three things at once *sigh* I bow before your might and wisdom!

readme.rst
150

cool!

jskladan updated this revision to Diff 1989.Mar 14 2016, 3:29 PM
  • I bow before you, for you are the root
kparal accepted this revision.Mar 14 2016, 3:44 PM
This revision is now accepted and ready to land.Mar 14 2016, 3:44 PM
tflink accepted this revision.Mar 14 2016, 4:48 PM
tflink added a reviewer: tflink.

overall, LGTM. minor nits in the docs

readme.rst
178

Would it be worth noting that that settings.py would only be found by the user running testcloud or is that obvious enough?

Also, the user will need to be added to the testcloud group.

jskladan added inline comments.Mar 15 2016, 9:06 AM
readme.rst
178

Would it be worth noting that that settings.py would only be found by the user running testcloud or is that obvious enough?

I have a slow morning - just to be sure, you mean that the configuration will only be valid for the user, which sets the config file - i.e. that other users, or system services, won't be able to get to the config, and will most probably fail to use --libvirt, as the ssh-authorized-keys needs to be set in order for it to work?
Is there a better way/path to configure it?

Also, the user will need to be added to the testcloud group.

Are you sure? I'm not in the group, and it works fine.

kparal added inline comments.Mar 15 2016, 11:48 AM
readme.rst
178

I think let's just say "~/.config/testcloud/settings.py or /etc/testcloud/settings.py" and it's obvious enough.

Are you sure? I'm not in the group, and it works fine.

Yes, the same situation here. However, I'm in the libvirt group, which might grant needed privileges.

jskladan added inline comments.Mar 15 2016, 12:01 PM
readme.rst
178

I'm in qemu, mock, docker, FWIW

Closed by commit rLTRN8c640bcef264: Improve --libvirt default experience (authored by Josef Skladanka <jskladan@redhat.com>). · Explain WhyMar 16 2016, 6:33 AM
This revision was automatically updated to reflect the committed changes.