001/*
002 * To change this template, choose Tools | Templates
003 * and open the template in the editor.
004 */
005package org.anarres.qemu.exec.recipe;
006
007import javax.annotation.Nonnull;
008import org.anarres.qemu.exec.QEmuChardevOption;
009import org.anarres.qemu.exec.QEmuDeviceOption;
010import org.anarres.qemu.exec.host.chardev.CharDevice;
011import org.anarres.qemu.exec.util.QEmuOptionsList;
012
013/**
014 *
015 * @see QEmuChardevOption
016 * @see QEmuDeviceOption.VirtioSerial
017 * @author shevek
018 */
019public class QEmuVirtioSerialRecipe extends QEmuOptionsList implements QEmuRecipe {
020
021    public final QEmuChardevOption chardevOption;
022    public final QEmuDeviceOption.VirtioSerial deviceOption;
023
024    // See: http://wiki.qemu.org/Features/QAPI/GuestAgent
025    // name=org.qemu.guest_agent.0
026    public QEmuVirtioSerialRecipe(@Nonnull CharDevice device) {
027        int index = 0;
028        chardevOption = new QEmuChardevOption(device);
029        chardevOption
030                .withId("backend-serial-" + index);
031        add(chardevOption);
032        deviceOption = new QEmuDeviceOption.VirtioSerial();
033        deviceOption
034                .withId("serial-" + index)
035                .withChardev(chardevOption);
036        add(deviceOption);
037    }
038}