Chicken & chorizo traybake

Ingredients:
140g cooking chorizo, 2 red onions, cut into wedges, 4 garlic cloves, left whole, 4 chicken thighs, 4 chicken drumsticks, 4 medium potatoes, unpeeled and cut into wedges, 2 rosemary sprigs, 2 tbsp olive oil