From: Jan Fajerski Date: Thu, 20 Dec 2018 12:53:41 +0000 (+0100) Subject: ceph-volume: functional tests, add libvirt customization X-Git-Tag: v14.1.0~319^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25895%2Fhead;p=ceph.git ceph-volume: functional tests, add libvirt customization Signed-off-by: Jan Fajerski --- diff --git a/src/ceph-volume/ceph_volume/tests/functional/.gitignore b/src/ceph-volume/ceph_volume/tests/functional/.gitignore index b08b4dbe0345..a2ee2e58b9f6 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/.gitignore +++ b/src/ceph-volume/ceph_volume/tests/functional/.gitignore @@ -2,3 +2,4 @@ .vagrant/ vagrant_ssh_config fetch/ +global_vagrant_variables.yml diff --git a/src/ceph-volume/ceph_volume/tests/functional/README.md b/src/ceph-volume/ceph_volume/tests/functional/README.md new file mode 100644 index 000000000000..b9e892ac1223 --- /dev/null +++ b/src/ceph-volume/ceph_volume/tests/functional/README.md @@ -0,0 +1,24 @@ +# ceph-volume functional test suite + +This test suite is based on vagrant and is normally run via Jenkins on github +PRs. With a functioning Vagrant installation these test can also be run locally +(tested with vagrant's libvirt provider). + +## Vagrant with libvirt +By default the tests make assumption on the network segments to use (public and +cluster network), as well as the libvirt storage pool and uri. In an unused +vagrant setup these defaults should be fine. +If you prefer to explicitly configure the storage pool and libvirt +uri, create a file +`$ceph_repo/src/ceph-volume/ceph_volume/tests/functional/global_vagrant_variables.yml` +with content as follows: +``` yaml +libvirt_uri: qemu:///system +libvirt_storage_pool: 'vagrant-ceph-nvme' +``` +Adjust the values as needed. + +After this descend into a test directory (e.g. +`$ceph_repo/src/ceph-volume/ceph_volume/tests/functional/lvm` and run `tox -vre +centos7-bluestore-create -- --provider=libvirt` to execute the tests in +`$ceph_repo/src/ceph-volume/ceph_volume/tests/functional/lvm/centos7/bluestore/create/` diff --git a/src/ceph-volume/ceph_volume/tests/functional/Vagrantfile b/src/ceph-volume/ceph_volume/tests/functional/Vagrantfile index 76eb8f0d8643..9341698e7345 100644 --- a/src/ceph-volume/ceph_volume/tests/functional/Vagrantfile +++ b/src/ceph-volume/ceph_volume/tests/functional/Vagrantfile @@ -7,6 +7,21 @@ VAGRANTFILE_API_VERSION = '2' DEBUG = false +global_settings = {} +if File.symlink?(__FILE__) + global_config = File.expand_path( + File.join( + File.dirname(File.readlink(__FILE__)), + 'global_vagrant_variables.yml') + ) + if File.exist?(global_config) + global_settings = YAML.load_file(global_config) + end +end + +LIBVIRT_URI = global_settings.fetch('libvirt_uri', '') +LIBVIRT_STORAGE_POOL = global_settings.fetch('libvirt_storage_pool', '') + config_file=File.expand_path(File.join(File.dirname(__FILE__), 'vagrant_variables.yml')) settings=YAML.load_file(config_file) @@ -46,10 +61,18 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.ssh.private_key_path = settings['ssh_private_key_path'] config.ssh.username = USER - # When using libvirt, avoid errors like: - # "CPU feature cmt not found" config.vm.provider :libvirt do |lv| + # When using libvirt, avoid errors like: + # "CPU feature cmt not found" lv.cpu_mode = 'host-passthrough' + # set libvirt uri if present + if not LIBVIRT_URI.empty? + lv.uri = LIBVIRT_URI + end + # set libvirt storage pool if present + if not LIBVIRT_STORAGE_POOL.empty? + lv.storage_pool_name = LIBVIRT_STORAGE_POOL + end end # Faster bootup. Disables mounting the sync folder for libvirt and virtualbox