Skip to content

Commit

Permalink
Modify for use by CRC; add bundle logic, libvirt rename, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Apr 17, 2019
1 parent f328c4b commit c46fbe1
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 251 deletions.
15 changes: 0 additions & 15 deletions Dockerfile.alpine3.4

This file was deleted.

15 changes: 0 additions & 15 deletions Dockerfile.alpine3.5

This file was deleted.

10 changes: 5 additions & 5 deletions Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM centos:7

MAINTAINER Daniel Hiltgen <[email protected]>
MAINTAINER CodeReady Containers

ARG MACHINE_VERSION
ARG GO_VERSION
Expand All @@ -9,10 +9,10 @@ ENV GOPATH /go
RUN yum install -y libvirt-devel curl git gcc
RUN curl -sSL https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xzf -
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin
RUN git clone --branch ${MACHINE_VERSION} https://github.com/docker/machine.git /go/src/github.com/docker/machine
RUN git clone --branch ${MACHINE_VERSION} https://github.com/code-ready/machine.git /go/src/github.com/code-ready/machine

COPY . /go/src/github.com/dhiltgen/docker-machine-kvm
WORKDIR /go/src/github.com/dhiltgen/docker-machine-kvm
COPY . /go/src/github.com/code-ready/machine-driver-libvirt
WORKDIR /go/src/github.com/code-ready/machine-driver-libvirt
RUN go get -v -d ./...

RUN go install -v ./cmd/docker-machine-driver-kvm
RUN go install -v ./cmd/machine-driver-libvirt
18 changes: 0 additions & 18 deletions Dockerfile.ubuntu14.04

This file was deleted.

10 changes: 5 additions & 5 deletions Dockerfile.ubuntu16.04
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:16.04

MAINTAINER Daniel Hiltgen <[email protected]>
MAINTAINER CodeReady Containers

ARG MACHINE_VERSION
ARG GO_VERSION
Expand All @@ -9,10 +9,10 @@ ENV GOPATH /go
RUN apt-get update && apt-get install -y libvirt-dev curl git gcc
RUN curl -sSL https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xzf -
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin
RUN git clone --branch ${MACHINE_VERSION} https://github.com/docker/machine.git /go/src/github.com/docker/machine
RUN git clone --branch ${MACHINE_VERSION} https://github.com/code-ready/machine.git /go/src/github.com/code-ready/machine

COPY . /go/src/github.com/dhiltgen/docker-machine-kvm
WORKDIR /go/src/github.com/dhiltgen/docker-machine-kvm
COPY . /go/src/github.com/code-ready/machine-driver-libvirt
WORKDIR /go/src/github.com/code-ready/machine-driver-libvirt
RUN go get -v -d ./...

RUN go install -v ./cmd/docker-machine-driver-kvm
RUN go install -v ./cmd/machine-driver-libvirt
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MACHINE_VERSION=v0.10.0
GO_VERSION=1.8.1
DESCRIBE=$(shell git describe --tags)

TARGETS=$(addprefix $(PREFIX)-, alpine3.4 alpine3.5 ubuntu14.04 ubuntu16.04 centos7)
TARGETS=$(addprefix $(PREFIX)-, centos7 ubuntu16.04)

build: $(TARGETS)

Expand Down
4 changes: 0 additions & 4 deletions cmd/docker-machine-driver-kvm/Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions cmd/docker-machine-driver-kvm/main.go

This file was deleted.

4 changes: 4 additions & 0 deletions cmd/machine-driver-libvirt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
default: build

build:
GOGC=off go build -i -o machine-driver-libvirt
10 changes: 10 additions & 0 deletions cmd/machine-driver-libvirt/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package main

import (
"github.com/code-ready/machine-driver-libvirt"
"github.com/code-ready/machine/libmachine/drivers/plugin"
)

func main() {
plugin.RegisterDriver(libvirt.NewDriver("default", "path"))
}
49 changes: 49 additions & 0 deletions constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package libvirt

const (
DriverName = "libvirt"
DriverVersion = "0.9.0"

connectionString = "qemu:///system"
privateNetworkName = "crc"
dnsmasqLeases = "/var/lib/libvirt/dnsmasq/%s.leases"
dnsmasqStatus = "/var/lib/libvirt/dnsmasq/%s.status"
defaultSSHUser = "core"

domainXMLTemplate = `<domain type='kvm'>
<name>{{.MachineName}}</name>
<memory unit='MB'>{{.Memory}}</memory>
<vcpu>{{.CPU}}</vcpu>
<features><acpi/><apic/><pae/></features>
<cpu mode='host-passthrough'></cpu>
<os>
<type>hvm</type>
<boot dev='hd'/>
<bootmenu enable='no'/>
</os>
<devices>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='{{.CacheMode}}' io='{{.IOMode}}' />
<source file='{{.DiskPath}}'/>
<target dev='hda' bus='ide'/>
</disk>
<graphics type='vnc' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<interface type='network'>
<source network='{{.Network}}'/>
</interface>
<interface type='network'>
<source network='{{.PrivateNetwork}}'/>
</interface>
</devices>
</domain>`
networkXML = `<network>
<name>%s</name>
<ip address='%s' netmask='%s'>
<dhcp>
<range start='%s' end='%s'/>
</dhcp>
</ip>
</network>`
)
Loading

0 comments on commit c46fbe1

Please sign in to comment.