lxd/db/storage_pools.go
func (c *Cluster) StoragePoolVolumeSnapshotsGetType(volumeName string, volumeType int, poolID int64) ([]string, error) {
	result := []string{}
	regexp := volumeName + shared.SnapshotDelimiter
	length := len(regexp)

	query := "SELECT name FROM storage_volumes WHERE storage_pool_id=? AND node_id=? AND type=? AND snapshot=? AND SUBSTR(name,1,?)=?"
	inargs := []interface{}{poolID, c.nodeID, volumeType, true, length, regexp}
	outfmt := []interface{}{volumeName}

	dbResults, err := queryScan(c.db, query, inargs, outfmt)
	if err != nil {
		return result, err
	}

	for _, r := range dbResults {
		result = append(result, r[0].(string))
	}

	return result, nil
}
func (c *Cluster) StoragePoolVolumeSnapshotsGetType(volumeName string, volumeType int, poolID int64) ([]string, error) {
	result := []string{}
	regexp := volumeName + shared.SnapshotDelimiter
	length := len(regexp)

	query := "SELECT name FROM storage_volumes WHERE storage_pool_id=? AND node_id=? AND type=? AND snapshot=? AND SUBSTR(name,1,?)=?"
	inargs := []interface{}{poolID, c.nodeID, volumeType, true, length, regexp}
	outfmt := []interface{}{volumeName}

	dbResults, err := queryScan(c.db, query, inargs, outfmt)
	if err != nil {
		return result, err
	}

	for _, r := range dbResults {
		result = append(result, r[0].(string))
	}

	return result, nil
}
// StoragePoolVolumeSnapshotsGetType get all snapshots of a storage volume
// attached to a given storage pool of a given volume type, on the given node.