@@ -13,10 +13,11 @@ import (
1313 "github.com/Azure/go-autorest/autorest/to"
1414 "github.com/nanovms/ops/lepton"
1515 "github.com/nanovms/ops/log"
16+ "github.com/nanovms/ops/types"
1617)
1718
1819// CreateVolume uploads the volume raw file and creates a disk from it
19- func (a * Azure ) CreateVolume (ctx * lepton.Context , name , data , typeof , provider string ) (lepton.NanosVolume , error ) {
20+ func (a * Azure ) CreateVolume (ctx * lepton.Context , cv types. CloudVolume , data string , provider string ) (lepton.NanosVolume , error ) {
2021 config := ctx .Config ()
2122
2223 var vol lepton.NanosVolume
@@ -38,13 +39,13 @@ func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, typeof, provider s
3839 sizeInGb = int64 (size )
3940 }
4041
41- vol , err = lepton .CreateLocalVolume (config , name , data , provider )
42+ vol , err = lepton .CreateLocalVolume (config , cv . Name , data , provider )
4243 if err != nil {
4344 return vol , fmt .Errorf ("create local volume: %v" , err )
4445 }
4546 defer os .Remove (vol .Path )
4647
47- config .CloudConfig .ImageName = name
48+ config .CloudConfig .ImageName = cv . Name
4849
4950 err = a .Storage .CopyToBucket (config , vol .Path )
5051 if err != nil {
@@ -57,13 +58,13 @@ func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, typeof, provider s
5758 }
5859
5960 container := "quickstart-nanos"
60- disk := name + ".vhd"
61+ disk := cv . Name + ".vhd"
6162
6263 sourceURI := "https://" + bucket + ".blob.core.windows.net/" + container + "/" + disk
6364
6465 diskParams := compute.Disk {
6566 Location : to .StringPtr (location ),
66- Name : to .StringPtr (name ),
67+ Name : to .StringPtr (cv . Name ),
6768 DiskProperties : & compute.DiskProperties {
6869 HyperVGeneration : compute .V1 ,
6970 DiskSizeGB : to .Int32Ptr (int32 (sizeInGb )),
@@ -75,7 +76,7 @@ func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, typeof, provider s
7576 },
7677 }
7778
78- _ , err = disksClient .CreateOrUpdate (context .TODO (), a .groupName , name , diskParams )
79+ _ , err = disksClient .CreateOrUpdate (context .TODO (), a .groupName , cv . Name , diskParams )
7980 if err != nil {
8081 return vol , err
8182 }
0 commit comments