Skip to content

Commit

Permalink
Bumped drivercore version, added ImagesVersion
Browse files Browse the repository at this point in the history
A driver version can now use a different image repository version.
  • Loading branch information
rajch committed May 28, 2022
1 parent ddc0edc commit ace4340
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# driver-vbox

kutti driver for Oracle VirtualBox

[![Go Report Card](https://goreportcard.com/badge/github.com/kuttiproject/driver-vbox)](https://goreportcard.com/report/github.com/kuttiproject/driver-vbox)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/kuttiproject/driver-vbox)](https://pkg.go.dev/github.com/kuttiproject/driver-vbox)
![GitHub release (latest by date)](https://img.shields.io/github/v/release/kuttiproject/driver-vbox?include_prereleases)

## Images
This driver depends on VirtualBox VM images published via the [kuttiproject/driver-vbox-images](https://github.com/kuttiproject/driver-vbox-images) repository. The details of the driver-to-VM interface are documented there.

The releases of that repository are the default source for this driver. The list of available/deprecated images and the images themselves are published there. The releases match the major and minor versions of this repository, and vice versa.
This driver depends on VirtualBox VM images published via the [kuttiproject/driver-vbox-images](https://github.com/kuttiproject/driver-vbox-images) repository. The details of the driver-to-VM interface are documented there.

The releases of that repository are the default source for this driver. The list of available/deprecated images and the images themselves are published there. The releases of that repository follow the major and minor versions of this repository, but sometimes may lag by one version. The `ImagesVersion` constant specifies the version of the images repository that is used by a particular version of this driver.
7 changes: 6 additions & 1 deletion driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Driver struct {
errormessage string
}

// Name returns the "vbox"
// Name returns "vbox"
func (vd *Driver) Name() string {
return driverName
}
Expand All @@ -32,6 +32,11 @@ func (vd *Driver) Description() string {
return driverDescription
}

// UsesPerClusterNetworking returns true
func (vd *Driver) UsesPerClusterNetworking() bool {
return true
}

// UsesNATNetworking returns true
func (vd *Driver) UsesNATNetworking() bool {
return true
Expand Down
8 changes: 6 additions & 2 deletions drivervbox-imagemanagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import (
"github.com/kuttiproject/workspace"
)

// ImagesVersion defines the image repository version for the current version
// of the driver.
const ImagesVersion = "0.2"

const imagesConfigFile = "driver-vbox-images.json"

// ImagesSourceURL is the location where the master list of images can be found
var ImagesSourceURL = "https://github.com/kuttiproject/driver-vbox-images/releases/download/v0.2/driver-vbox-images.json"
var ImagesSourceURL = "https://github.com/kuttiproject/driver-vbox-images/releases/download/v" + ImagesVersion + "/" + imagesConfigFile

var (
imagedata = &imageconfigdata{}
Expand Down Expand Up @@ -42,7 +46,7 @@ func (icd *imageconfigdata) Setdefaults() {
}

func vboxCacheDir() (string, error) {
return workspace.Cachesubdir("vbox")
return workspace.Cachesubdir("driver-vbox")
}

func vboxConfigDir() (string, error) {
Expand Down
2 changes: 1 addition & 1 deletion drivervbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func init() {
driver := newvboxdriver()

drivercore.RegisterDriver("vbox", driver)
drivercore.RegisterDriver(driverName, driver)
}

func newvboxdriver() *Driver {
Expand Down
2 changes: 1 addition & 1 deletion drivervbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestDriverVBox(t *testing.T) {

<-time.After(5 * time.Second)

err = workspace.Set("/home/raj/projects/kuttiproject/driver-vbox/out")
err = workspace.Set("out/")
if err != nil {
t.Fatalf("Error: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kuttiproject/driver-vbox
go 1.16

require (
github.com/kuttiproject/drivercore v0.1.3
github.com/kuttiproject/drivercore v0.2.0
github.com/kuttiproject/kuttilog v0.1.2
github.com/kuttiproject/workspace v0.2.2
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/kuttiproject/drivercore v0.1.3 h1:dX57IlZhYX2AZ3BVDWTF12mn35fK1/MV974r/WpSxvc=
github.com/kuttiproject/drivercore v0.1.3/go.mod h1:1C1TMGfQ4u/5ltHUtl4hL7gYzXZyZQVhkOha4GuOzk0=
github.com/kuttiproject/drivercore v0.2.0 h1:RZI/azMsyI8gPidXzHPcZXqajHPdq+zaRg3W4x9ASC0=
github.com/kuttiproject/drivercore v0.2.0/go.mod h1:1C1TMGfQ4u/5ltHUtl4hL7gYzXZyZQVhkOha4GuOzk0=
github.com/kuttiproject/kuttilog v0.1.2 h1:VEqVWrR3M6RME6aoUuVwXNO3bRpHKNp0ISAP/vqncpg=
github.com/kuttiproject/kuttilog v0.1.2/go.mod h1:OO3dHpXm1/Pjlc57R4c0e/C+ZWkYlY3Fd9Ikn8xPXi4=
github.com/kuttiproject/workspace v0.2.2 h1:1eNdMooB6Oq7jq2wodbuaY+IVZSYcEuXnqY3e00s64Y=
Expand Down

0 comments on commit ace4340

Please sign in to comment.