File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ The plugin attaches block storage volumes to the compute instance running the pl
1212* KVM w/ virtio
1313
1414
15- ## Usage
15+ ## Setup
1616
1717Provide configuration for the plugin:
1818
@@ -44,6 +44,14 @@ INFO Connected. endpoint="http://api.os.xopic
4444
4545By default a ` cinder.json ` from the current working directory will be used.
4646
47+ ## Usage
48+
49+ The default volume size is 10GB but can be overridden:
50+
51+ ```
52+ $ docker volume create -d cinder -o size=20 volname
53+ ```
54+
4755
4856## Notes
4957
Original file line number Diff line number Diff line change 88 "os"
99 "os/exec"
1010 "path/filepath"
11+ "strconv"
1112 "strings"
1213 "sync"
1314 "syscall"
@@ -84,8 +85,20 @@ func (d plugin) Create(r *volume.CreateRequest) error {
8485 d .mutex .Lock ()
8586 defer d .mutex .Unlock ()
8687
88+ // DEFAULT SIZE IN GB
89+ var size = 10
90+ var err error
91+
92+ if s , ok := r .Options ["size" ]; ok {
93+ size , err = strconv .Atoi (s )
94+ if err != nil {
95+ logger .WithError (err ).Error ("Error parsing size option" )
96+ return fmt .Errorf ("Invalid size option: %s" , err .Error ())
97+ }
98+ }
99+
87100 vol , err := volumes .Create (d .blockClient , volumes.CreateOpts {
88- Size : 10 ,
101+ Size : size ,
89102 Name : r .Name ,
90103 }).Extract ()
91104
You can’t perform that action at this time.
0 commit comments