Skip to content

Add flags for vde and socket from vde_switch #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ Options:
- `--qemu-display-type` : Select type of display to use (sdl/vnc=localhost:0/etc)
- `--qemu-nographic` : Use -nographic instead of -display none. Default: false
- `--qemu-virtio-drives` : Use virtio for drives (cdrom and disk). Default: false
- `--qemu-network`: Networking to be used: user, tap or bridge. Default: `user`
- `--qemu-network`: Networking to be used: user, tap, vde or bridge. Default: `user`
- `--qemu-network-interface`: Name of the network interface to be used for networking. Default: `tap0`
- `--qemu-network-address`: IP of the network address to be used for networking.
- `--qemu-network-socket`: Path of the network socket to be used for networking.
- `--qemu-network-bridge`: Name of the network bridge to be used for networking. Default: `br0`

The `--qemu-boot2docker-url` flag takes a few different forms. By
Expand All @@ -53,7 +54,7 @@ using the `http://` form.
Note that when using virtio the drives will be mounted as `/dev/vda` and `/dev/vdb`,
instead of the usual `/dev/cdrom` and `/dev/sda`, since they are using paravirtualization.

If using the real network (tap or bridge), note that it needs a DHCP server running.
If using the real network (tap, vde or bridge), note that it needs a DHCP server running.
The user network has it's own NAT network, which usually means it is running on 10.0.2.15
Ultimately this driver should be able to query for IP, but for now the workaround is
to use `--qemu-network-address` (and fixed addresses) until that feature is implemented.
Expand Down
11 changes: 11 additions & 0 deletions qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Driver struct {
Boot2DockerURL string
NetworkInterface string
NetworkAddress string
NetworkSocket string
NetworkBridge string
CaCertPath string
PrivateKeyPath string
Expand Down Expand Up @@ -124,6 +125,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: "qemu-network-address",
Usage: "IP of the network adress to be used for networking (for tap)",
},
mcnflag.StringFlag{
Name: "qemu-network-socket",
Usage: "Path of the network socket to be used for networking (for vde)",
Value: "tap0",
},
mcnflag.StringFlag{
Name: "qemu-network-bridge",
Usage: "Name of the network bridge to be used for networking (for bridge)",
Expand Down Expand Up @@ -210,6 +216,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.Boot2DockerURL = flags.String("qemu-boot2docker-url")
d.NetworkInterface = flags.String("qemu-network-interface")
d.NetworkAddress = flags.String("qemu-network-address")
d.NetworkSocket = flags.String("qemu-network-socket")
d.NetworkBridge = flags.String("qemu-network-bridge")
d.CacheMode = flags.String("qemu-cache-mode")
d.IOMode = flags.String("qemu-io-mode")
Expand Down Expand Up @@ -489,6 +496,10 @@ func (d *Driver) Start() error {
startCmd = append(startCmd,
"-nic", fmt.Sprintf("tap,model=virtio,ifname=%s,script=no,downscript=no", d.NetworkInterface),
)
} else if d.Network == "vde" {
startCmd = append(startCmd,
"-nic", fmt.Sprintf("vde,model=virtio,sock=%s", d.NetworkSocket),
)
} else if d.Network == "bridge" {
startCmd = append(startCmd,
"-nic", fmt.Sprintf("bridge,model=virtio,br=%s", d.NetworkBridge),
Expand Down