'Attach each volume to the master node'

def attach_volumes_to_master(self):

    wait_for_volumes = []
    for vol in self.volumes:
        volume = self.volumes.get(vol)
        device = volume.get('device')
        vol_id = volume.get('volume_id')
        vol = self.ec2.get_volume(vol_id)
        if (vol.attach_data.instance_id == self.master_node.id):
            log.info(('Volume    %s    already    attached    to    master...skipping' % vol.id))
            continue
        if (vol.status != 'available'):
            log.error(('Volume    %s    not    available...please    check    and    try    again' % vol.id))
            continue
        log.info(('Attaching    volume    %s    to    master    node    on    %s    ...' % (vol.id, device)))
        resp = vol.attach(self.master_node.id, device)
        log.debug(('resp    =    %s' % resp))
        wait_for_volumes.append(vol)
    for vol in wait_for_volumes:
        self.ec2.wait_for_volume(vol, state='attached')
