Skip to content

Commit

Permalink
Merge pull request #172 from NeowayLabs/addExampleOfBackupOnDiffRegion
Browse files Browse the repository at this point in the history
Add support to backup on different regions
  • Loading branch information
katcipis authored Sep 15, 2018
2 parents f83de47 + 2869417 commit cd342d1
Show file tree
Hide file tree
Showing 21 changed files with 843 additions and 81 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# Release 0.11.0

This release breaks compatibility of the vm package.

The functions that have changed are:

* azure_vm_backup_create
* azure_snapshot_create

To be more compatible with azure behavior of not allowing snapshots to
be on a different location than the source disks used to generate them.

We also added new functionality to enable backups to be copied through
different locations, check the functions:

* azure_vm_backup_copy
* azure_snapshot_copy

There are examples provided on the project for both functionalities.


# Release 0.10.0

This release breaks compatibility of the storage package to
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ install: guard-NASHPATH
@cp -pr ./tools/azure/getcredentials.sh $(bindir)/azure-credentials.sh
@cp -pr ./tools/azure/createsp.sh $(bindir)/createsp.sh

timeout=120m
logger=file
parallel=20 #Explore I/O parallelization
cpu=10 # Force threads to be created
timeout?=90m
logger?=file
parallel?=10 # Explore I/O parallelization
cpu?=5 # Force threads to be created
gotest=go test -v ./tests/azure -parallel $(parallel) -cpu $(cpu)
gotestargs=-args -logger $(logger)

test: image
./hack/run.sh nash ./azure/vm_test.sh

test-integration: image
./hack/run.sh $(gotest) -timeout $(timeout) -run=$(run) ./... $(gotestargs)
./hack/run.sh $(gotest) -timeout $(timeout) -run=$(run) $(gotestargs)

test-examples: image
./hack/run.sh $(gotest) -timeout $(timeout) -tags=examples -run=TestExamples $(gotestargs)
Expand Down
28 changes: 27 additions & 1 deletion azure/group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ fn azure_group_create(name, location) {
azure group create --name $name --location $location
}

# azure_group_delete deletes a exit `resource group`.
# azure_group_delete deletes a `resource group`.
# `name` is the resource group name
fn azure_group_delete(name) {
azure group delete -q --name $name
}

# azure_group_delete_async deletes a `resource group`.
# `name` is the resource group name
#
# This function will return imediately (wont wait the delete operation to finish).
fn azure_group_delete_async(name) {
out, status <= az group delete --yes --no-wait --name $name
if $status != "0" {
format("error deleting resgroup[%s]: %s", $name, $out)
}
return ""
}

# azure_group_get_names returns a list with the names
# of all available resource groups
fn azure_group_get_names() {
Expand All @@ -32,3 +44,17 @@ fn azure_group_exists(name) {

return "1"
}

# azure_group_location gets the location of a given resgroup.
#
# It returns two values, the location and an empty error string on success or
# an empty string and an error string if something goes wrong.
fn azure_group_location(name) {
out, status <= az group show --name $name >[2=1]
if $status != "0" {
return "", format("error loading resgroup[%s] location: %s", $name, $out)
}

location <= echo $out | jq -r ".location"
return $location, ""
}
3 changes: 2 additions & 1 deletion azure/lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ fn _azure_lock_delete(lockname, resgroup, trycount) {

out, status <= az lock list | grep $lockname
if $status == "0" {
log(format("lock[%s] still exists, trying again", $lockname))
log(format("lock[%s] still exists, output: %s", $lockname, $out))
log(format("trying again"))
pollingtimesec = "1"
trycount <= expr $trycount "+" "1"
sleep $pollingtimesec
Expand Down
Loading

0 comments on commit cd342d1

Please sign in to comment.