def _lvm_disks(self, instance):
    'Returns all LVM disks for given instance object.'
    if CONF.libvirt.images_volume_group:
        vg = os.path.join('/dev', CONF.libvirt.images_volume_group)
        if (not os.path.exists(vg)):
            return []
        pattern = ('%s_' % instance['uuid'])

        def belongs_to_instance_legacy(disk):
            pattern = ('%s_' % instance['name'])
            if disk.startswith(pattern):
                if (CONF.instance_name_template == 'instance-%08x'):
                    return True
                else:
                    LOG.warn(_LW('Volume %(disk)s possibly unsafe to remove, please clean up manually'), {'disk': disk})
            return False

        def belongs_to_instance(disk):
            return disk.startswith(pattern)

        def fullpath(name):
            return os.path.join(vg, name)
        logical_volumes = lvm.list_volumes(vg)
        disk_names = filter(belongs_to_instance, logical_volumes)
        disk_names.extend(filter(belongs_to_instance_legacy, logical_volumes))
        disks = map(fullpath, disk_names)
        return disks
    return []
Returns all LVM disks for given instance object.
def _lvm_disks(self, instance):
    
    if CONF.libvirt.images_volume_group:
        vg = os.path.join('/dev', CONF.libvirt.images_volume_group)
        if (not os.path.exists(vg)):
            return []
        pattern = ('%s_' % instance['uuid'])

        def belongs_to_instance_legacy(disk):
            pattern = ('%s_' % instance['name'])
            if disk.startswith(pattern):
                if (CONF.instance_name_template == 'instance-%08x'):
                    return True
                else:
                    LOG.warn(_LW('Volume %(disk)s possibly unsafe to remove, please clean up manually'), {'disk': disk})
            return False

        def belongs_to_instance(disk):
            return disk.startswith(pattern)

        def fullpath(name):
            return os.path.join(vg, name)
        logical_volumes = lvm.list_volumes(vg)
        disk_names = filter(belongs_to_instance, logical_volumes)
        disk_names.extend(filter(belongs_to_instance_legacy, logical_volumes))
        disks = map(fullpath, disk_names)
        return disks
    return []