In rackspace regions we have an xvde ephemeral device on which we partition then format a partition for swap. We attempt to use the first partition, xvde1, for swap and use mkswap to format for swap. Unfortunately this appears to fail occasionally (not frequently but enough that we should have a bug tracking it).
Example at http://logs.openstack.org/57/484157/4/gate/gate-tempest-dsvm-neutron-full-ubuntu-xenial/bdde7b1/logs/devstack-gate-setup-workspace-new.txt with complete file contents pasted below.
localhost | FAILED | rc=1 >>
2017-07-24 13:03:25.571 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:setup_workspace:L492: '[' -z master ']'
2017-07-24 13:03:25.573 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:setup_workspace:L497: fix_disk_layout
2017-07-24 13:03:25.575 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L308: [[ -e /etc/fixed_disk_layout ]]
2017-07-24 13:03:25.576 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L308: sudo touch /etc/fixed_disk_layout
2017-07-24 13:03:25.577 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L316: SWAPSIZE=8192
2017-07-24 13:03:25.579 | ++ /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L317: grep SwapTotal /proc/meminfo
2017-07-24 13:03:25.580 | ++ /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L317: awk '{ print $2; }'
2017-07-24 13:03:25.582 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L317: swapcurrent=0
2017-07-24 13:03:25.583 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L319: [[ 0 -lt 8192 ]]
2017-07-24 13:03:25.585 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L320: '[' -b /dev/xvde ']'
2017-07-24 13:03:25.587 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L321: DEV=/dev/xvde
2017-07-24 13:03:25.588 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L328: '[' -n /dev/xvde ']'
2017-07-24 13:03:25.590 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L330: local swap=/dev/xvde1
2017-07-24 13:03:25.591 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L331: local lvmvol=/dev/xvde2
2017-07-24 13:03:25.592 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L332: local optdev=/dev/xvde3
2017-07-24 13:03:25.594 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L333: mount
2017-07-24 13:03:25.595 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L333: grep /dev/xvde
2017-07-24 13:03:25.596 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L338: sudo parted /dev/xvde --script -- mklabel msdos
2017-07-24 13:03:25.598 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L339: sudo parted /dev/xvde --script -- mkpart primary linux-swap 1 8192
2017-07-24 13:03:25.599 | Warning: The resulting partition is not properly aligned for best performance.
2017-07-24 13:03:25.600 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L340: sudo parted /dev/xvde --script -- mkpart primary ext2 8192 -1
2017-07-24 13:03:25.602 | Warning: The resulting partition is not properly aligned for best performance.
2017-07-24 13:03:25.603 | + /home/jenkins/workspace/gate-tempest-dsvm-neutron-full-ubuntu-xenial/devstack-gate/functions.sh:fix_disk_layout:L341: sudo mkswap /dev/xvde1
2017-07-24 13:03:25.604 | mkswap: cannot open /dev/xvde1: No such file or directory
It is possible that we need a to flush/sync the mkpart changes before running mkswap and we are just getting ahead of ourselves. here.
I derped https:/ /review. openstack. org/486676 and didn't add the bug properly to the commit. In any case https:/ /review. openstack. org/486676 is an attempt at addressing this.