def _ensure_ebs_vol_mounted(self, ec2_instance_id, vol_label, vol_config):
        with hide(*fab_quiet):
            # Wait for the volume attachment to complete
            logger.info(
                "Waiting for EBS volume %s to attach to device %s",
                vol_label,
                vol_config['device']
            )

            # ``stat`` on the device until it exists
            stat_result = sudo('stat %s' % vol_config['device'])
            while stat_result.return_code != 0:
                logger.info(
                    "Attachment pending. Waiting %s seconds.",
                    LAUNCH_REFRESH,
                )
                time.sleep(LAUNCH_REFRESH)
                stat_result = sudo('stat %s' % vol_config['device'])

            # Ensure all of the EBS fstab binds are configured
            logger.info("Binding/Mounting EBS directories")

            if vol_config['filesystem'] != 'xfs':
                raise NotImplementedError(
                    "Only the xfs filesystem is implemented")

            # Mount the EBS volume
            sudo("mkdir %s --parent" % vol_config['mount_point'])
            with hide(*fab_quiet):
                sudo("mount %s" % vol_config['mount_point'])

            # Mount all of the bound folders
            for ebs_bind_confs in vol_config['ebs_bound_dirs']:
                src_path = ebs_bind_confs['src_path']
                bind_path = ebs_bind_confs['bind_path']
                sudo('mkdir %s --parent' % bind_path)
                sudo('mkdir %s --parent' % src_path)
                logger.info(
                    "Mounting bound dir %s to %s",
                    src_path,
                    bind_path,
                )
                mount_result = sudo('mount %s' % bind_path)
                if mount_result.failed:
                    logger.warning(
                        "Error mounting %s. Msg: %s",
                        bind_path,
                        mount_result)
                else:
                    # If the mount succeeded, optionally fix directory
                    # permissions and ownership
                    uid = ebs_bind_confs.get('uid', '')
                    gid = ebs_bind_confs.get('gid', '')
                    mode = ebs_bind_confs.get('mode', '')
                    if mode:
                        logger.info(
                            "Fixing directory mode on %s to %s",
                            bind_path,
                            mode,
                        )
                        sudo('chmod %s %s' % (mode, bind_path))
                    if uid or gid:
                        ownership = "%s:%s" % (uid, gid)
                        logger.info(
                            "Changing ownership of %s to %s",
                            bind_path,
                            ownership,
                        )
                        sudo('chown %s %s' % (ownership, bind_path))

            if vol_config['filesystem'] == 'xfs':
                # Grow the file systems if needed
                logger.info("Growing the file system")
                with hide(*fab_quiet):
                    sudo('xfs_growfs %s' % vol_config['mount_point'])
Ensure a single EBS volume is succesfully mounted and any required
dataset/ETHPy150Open winhamwr/neckbeard/neckbeard/cloud_provisioners/aws/ec2.py/Ec2NodeDeployment._ensure_ebs_vol_mounted