@@ -13,10 +13,11 @@ import (
13
13
"github.com/Azure/go-autorest/autorest/to"
14
14
"github.com/nanovms/ops/lepton"
15
15
"github.com/nanovms/ops/log"
16
+ "github.com/nanovms/ops/types"
16
17
)
17
18
18
19
// 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 ) {
20
21
config := ctx .Config ()
21
22
22
23
var vol lepton.NanosVolume
@@ -38,13 +39,13 @@ func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, typeof, provider s
38
39
sizeInGb = int64 (size )
39
40
}
40
41
41
- vol , err = lepton .CreateLocalVolume (config , name , data , provider )
42
+ vol , err = lepton .CreateLocalVolume (config , cv . Name , data , provider )
42
43
if err != nil {
43
44
return vol , fmt .Errorf ("create local volume: %v" , err )
44
45
}
45
46
defer os .Remove (vol .Path )
46
47
47
- config .CloudConfig .ImageName = name
48
+ config .CloudConfig .ImageName = cv . Name
48
49
49
50
err = a .Storage .CopyToBucket (config , vol .Path )
50
51
if err != nil {
@@ -57,13 +58,13 @@ func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, typeof, provider s
57
58
}
58
59
59
60
container := "quickstart-nanos"
60
- disk := name + ".vhd"
61
+ disk := cv . Name + ".vhd"
61
62
62
63
sourceURI := "https://" + bucket + ".blob.core.windows.net/" + container + "/" + disk
63
64
64
65
diskParams := compute.Disk {
65
66
Location : to .StringPtr (location ),
66
- Name : to .StringPtr (name ),
67
+ Name : to .StringPtr (cv . Name ),
67
68
DiskProperties : & compute.DiskProperties {
68
69
HyperVGeneration : compute .V1 ,
69
70
DiskSizeGB : to .Int32Ptr (int32 (sizeInGb )),
@@ -75,7 +76,7 @@ func (a *Azure) CreateVolume(ctx *lepton.Context, name, data, typeof, provider s
75
76
},
76
77
}
77
78
78
- _ , err = disksClient .CreateOrUpdate (context .TODO (), a .groupName , name , diskParams )
79
+ _ , err = disksClient .CreateOrUpdate (context .TODO (), a .groupName , cv . Name , diskParams )
79
80
if err != nil {
80
81
return vol , err
81
82
}
0 commit comments