Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vahaah committed Jun 7, 2016
1 parent 7f45475 commit 865f578
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.2 (2016-06-07)

Bug fix

## 1.0.1 (2016-06-02)

Added SWAP
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To install this plugin manually, download the binary `docker-machine-driver-vsca
and make it available by `$PATH`, for example by putting it to `/usr/local/bin/`:

```console
$ curl -L https://github.com/vahaah/docker-machine-driver-vscale/releases/download/1.0.1/docker-machine-driver-vscale > /usr/local/bin/docker-machine-driver-vscale
$ curl -L https://github.com/vahaah/docker-machine-driver-vscale/releases/download/1.0.2/docker-machine-driver-vscale > /usr/local/bin/docker-machine-driver-vscale

$ chmod +x /usr/local/bin/docker-machine-driver-vscale
```
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "fmt"
var GitCommit string

// Version number that is being run at the moment.
const Version = "1.0.1"
const Version = "1.0.2"

// FullVersion formats the version to be printed.
func FullVersion() string {
Expand Down
37 changes: 25 additions & 12 deletions vscale.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"net"
"time"
"reflect"
"io/ioutil"

"github.com/docker/machine/libmachine/drivers"
Expand All @@ -27,7 +28,7 @@ type Driver struct {
}

const (
defaultRplan = "small"
defaultRplan = "small"
defaultLocation = "spb0"
defaultMadeFrom = "ubuntu_14.04_64_002_master"
defaultSwapFile = 0
Expand Down Expand Up @@ -190,18 +191,30 @@ func (d *Driver) Create() error {
time.Sleep(1 * time.Second)
}

log.Info(fmt.Sprintf("Created scalet with ID: %v, IPAddress: %v", d.ScaletID, d.IPAddress))
log.Info(fmt.Sprintf("Creating scalet with ID: %v, IPAddress: %v", d.ScaletID, d.IPAddress))
if d.SwapFile > 0 {
log.Info(fmt.Sprintf("Creating SWAP file %d MB", d.SwapFile))

_, err := drivers.RunSSHCommandFromDriver(d, fmt.Sprintf(`touch /var/swap.img && \
chmod 600 /var/swap.img && \
dd if=/dev/zero of=/var/swap.img bs=1MB count=%d && \
mkswap /var/swap.img && swapon /var/swap.img && \
echo '/var/swap.img none swap sw 0 0' >> /etc/fstab`, d.SwapFile))

if err != nil {
return err
for {
tasks, _, err := client.Scalet.Tasks()

if reflect.DeepEqual(tasks, &[]api.ScaletTask{}) {
log.Info(fmt.Sprintf("Creating SWAP file %d MB", d.SwapFile))
_, err := drivers.RunSSHCommandFromDriver(d, fmt.Sprintf(`touch /var/swap.img && \
chmod 600 /var/swap.img && \
dd if=/dev/zero of=/var/swap.img bs=1MB count=%d && \
mkswap /var/swap.img && swapon /var/swap.img && \
echo '/var/swap.img none swap sw 0 0' >> /etc/fstab`, d.SwapFile))

if err != nil {
return err
}
break
}

if err != nil {
return err
}

time.Sleep(1 * time.Second)
}
}
return nil
Expand Down

0 comments on commit 865f578

Please sign in to comment.