Browse Source

Rescan disk bus before using volume

In the LAMP stack workload, we found that one issue for interoperability
between clouds was that in some combinations of
hypervisor/adapter/storage is is necessary to rescan the scsi bus of a
guest VM in order to detect a newly attached Cinder volume.[1] We
neglected to do that in the K8s workload, so this patch ammends the
Ansible play that formats the volume to scan the SCSI bus first.

Note that the LAMP workload was targetted toward one guest OS platform
(Ubuntu), and worked by installing the scsitools package and running the
rescan-scsi-bus script that it provides.  The K8s workload is different
in that it's currently targetted toward multiple guests including Ubuntu
and CoreOS [2]...the latter of which doesn't have a package manager.
Rather than build conditionals into the code to handle this, I've taken
a slightly simpler and more platform-agnostic approach in this patch by
simply looking in /sys/class/scsi_host to see what adapters are present
and then scanning each of them with an echo command.  This approach has
a few advantages: 1.) it works on guest OS's in which the name of the
package containing the rescan-scsi-tools script is different than on
Ubuntu, 2.) it works on guest OS's that don't have a package manager at
all, and 3.) since it doesn't require installing any additional
software, it is slightly faster and requires trivially less disk
footprint.

[1] https://review.openstack.org/#/c/383923/
[2] CentOS support is coming too:
https://review.openstack.org/#/c/457199/

Change-Id: Ie7204a23bc7a7d1da9a8cc60e684fc987159a41a
Mark T. Voelker 2 years ago
parent
commit
1cc921cef4
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      workloads/ansible/shade/k8s/roles/worker/tasks/main.yml

+ 3
- 0
workloads/ansible/shade/k8s/roles/worker/tasks/main.yml View File

@@ -18,6 +18,9 @@
18 18
 - stat: path=/tmp/diskflag
19 19
   register: diskflag
20 20
 
21
+- shell: for adapter in $(echo `find /sys/class/scsi_host -name "host*"`); do echo "- - -" > ${adapter}/scan; done
22
+  when: diskflag.stat.exists == false
23
+
21 24
 - shell: parted -s "{{ app_env.block_device_name }}" mklabel msdos
22 25
   when: diskflag.stat.exists == false
23 26
 

Loading…
Cancel
Save