]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: functional tests, add libvirt customization 25895/head
authorJan Fajerski <jfajerski@suse.com>
Thu, 20 Dec 2018 12:53:41 +0000 (13:53 +0100)
committerJan Fajerski <jfajerski@suse.com>
Thu, 17 Jan 2019 16:57:29 +0000 (17:57 +0100)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/ceph-volume/ceph_volume/tests/functional/.gitignore
src/ceph-volume/ceph_volume/tests/functional/README.md [new file with mode: 0644]
src/ceph-volume/ceph_volume/tests/functional/Vagrantfile

index b08b4dbe034513c8b0a3146e4cc700290cb1ac1b..a2ee2e58b9f6cbcb15ac20b0f3be3ba095bdc1ca 100644 (file)
@@ -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 (file)
index 0000000..b9e892a
--- /dev/null
@@ -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/`
index 76eb8f0d8643cd5bf0fa641d1b13075d51bdb040..9341698e7345e1c0ae5a62a706ff4a5e7d266927 100644 (file)
@@ -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