Skip to main content

small helper script to download and boot cloud images locally

Project description

testcloud is a small helper script to download and boot cloud images locally. Currently only Fedora qcow2 images are tested and supported.

Requirements

Packages:
  • libvirt

  • libguestfs

  • libguestfs-tools

  • python-requests (for whatever python version you’re running)

Optional:
  • py.test (if you plan on running or working on the tests)

All of these packages are in the Fedora repos (and likely other distros as well).

For the moment, the follwing directories need to exist with permissions that allow modification by any permitted user:

/var/lib/testcloud/
/var/lib/testcloud/instances
/var/lib/testcloud/cache

This will be automagical in a future version of testcloud and is a side-effect of the current refactoring/transition process.

If you are running testcloud as a non-administrative user (ie. not in wheel) or on a system that doesn’t have a polkit agent running (custom setups, headless systems etc.), you may need to adjust local polkit configuration to allow non-root users to manage VMs with libvirt. Add the following data into /etc/polkit-1/localauthority/50-local.d/50-nonrootlivirt.pkla:

[nonroot libvirt system connection]
Identity=unix-group:testcloud
Action=org.libvirt.unix.manage
ResultActive=yes
ResultInactive=yes
ResultAny=yes

After writing that file, restart polkit (systemctl restart polkit) and if the user in question is a member of the unix group testcloud, that user should be able to run testcloud with no additional permissions.

Basic Usage

The usage varies slightly between using the git checkout and installing the module. To run testcloud straight from the git checkout, use

python run_testCloud.py instance create <instance name> -u <url for qcow2 image>

After installing via pip or setup.py, you can run

testcloud instance create <instance name> -u <url for qcow2 image>

This will download the qcow2 and store it in /var/tmp/cache/<qcow2 filename>. This will be used as a backing store for your instance under /var/tmp/instances/<instance name>. These instances will be viewable within virt-manager. To see your running instances run:

testcloud instance list

Instances can be stopped, started and destroyed as well through this interface. To see a list of options, run:

testcloud instance -h

Options

There are currently only three options (all optional) you can use when invoking this script: ‘–ram’, ‘–no-graphic’ and ‘–atomic’.

The –ram option takes an int for how much ram you want the guest to have, the --no-graphic option is merely a flag to suppress a GUI from appearing, the --atomic option indicates that you wish to boot an Atomic host (currently not tested).

Once the image has booted, you can log in from the GUI or ssh. To log in with ssh, run the following command:

ssh -F ./ssh_config testcloud

The user is ‘fedora’ and the password is ‘passw0rd’

Now you have a working local cloud image to test against.

Configuration

The default configuration should work for many people but those defaults can be overridden through the use of a settings.py file containing the values to use when overriding default settings. The example file in conf/settings-example.py shows the possible configuration values which can be changed.

Note that in order for those new values to be picked up, the filename must be settings.py and that file must live in one of the following locations:

  • conf/settings.py in the git checkout

  • ~/.config/testcloud/settings.py

  • /etc/testcloud/settings.py

Testing

There is a small testsuite you can run with:

py.test test/

This is a good place to contribute if you’re looking to help out.

Issue Tracking and Roadmap

Our project tracker is on the Fedora QA-devel Phabricator instance.

Credit

Thanks to Oddshocks for the koji downloader code :)

License

This code is licensed GPLv2+. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testcloud-0.0.1.tar.gz (13.5 kB view details)

Uploaded Source

File details

Details for the file testcloud-0.0.1.tar.gz.

File metadata

  • Download URL: testcloud-0.0.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for testcloud-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e525a38760f46eb0249ac913d1508c639414f20f3e2c8e7195f0ea85fcbffedf
MD5 f6a99f8f10287a90f8d449d90df038c8
BLAKE2b-256 7337cdb69ec4b895cde40c13596a55163b5c6defc6b2fbeb3dc540dac54b74a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page