mirror of
https://github.com/apache/jclouds.git
synced 2025-02-17 23:46:13 +00:00
changed create-volume to accept a Snapshot instance for :snapshot
This commit is contained in:
parent
9b366e255c
commit
1af5fccb0c
@ -214,7 +214,8 @@
|
|||||||
"Creates a new volume given a set of options:
|
"Creates a new volume given a set of options:
|
||||||
|
|
||||||
- one of :zone (keyword, string, or AvailabilityZone) or :node (NodeMetadata)
|
- one of :zone (keyword, string, or AvailabilityZone) or :node (NodeMetadata)
|
||||||
- one or both of :snapshot (keyword or string) or :size (string, keyword, or number)
|
- one or both of :snapshot (keyword, string, or Snapshot instance) or :size
|
||||||
|
(string, keyword, or number)
|
||||||
- :device (string or keyword) provided *only* when you want to attach the new volume to
|
- :device (string or keyword) provided *only* when you want to attach the new volume to
|
||||||
the :node you specified!
|
the :node you specified!
|
||||||
|
|
||||||
@ -234,12 +235,14 @@
|
|||||||
(create-volume :node node-instance :size 250)
|
(create-volume :node node-instance :size 250)
|
||||||
(create-volume :node node-instance :size 250 :device \"/dev/sdj\")
|
(create-volume :node node-instance :size 250 :device \"/dev/sdj\")
|
||||||
(create-volume :zone :eu-west-1b :snapshot \"snap-252310af\")
|
(create-volume :zone :eu-west-1b :snapshot \"snap-252310af\")
|
||||||
|
(create-volume :zone :eu-west-1b :snapshot snapshot-instance)
|
||||||
(create-volume :zone :eu-west-1b :snapshot \"snap-252310af\" :size :1024))"
|
(create-volume :zone :eu-west-1b :snapshot \"snap-252310af\" :size :1024))"
|
||||||
[& options]
|
[& options]
|
||||||
(when (-> options count odd?)
|
(when (-> options count odd?)
|
||||||
(throw (IllegalArgumentException. "Must provide key-value pairs, e.g. :zone :us-east-1d :size 200")))
|
(throw (IllegalArgumentException. "Must provide key-value pairs, e.g. :zone :us-east-1d :size 200")))
|
||||||
(let [options (apply hash-map options)
|
(let [options (apply hash-map options)
|
||||||
snapshot (get-string options :snapshot)
|
snapshot (get-string options :snapshot)
|
||||||
|
snapshot (if (snapshot? snapshot) (.getId snapshot) snapshot)
|
||||||
size (-?> (get-string options :size) as-int)
|
size (-?> (get-string options :size) as-int)
|
||||||
#^NodeMetadata node (:node options)
|
#^NodeMetadata node (:node options)
|
||||||
zone (or node (get-string options :zone))
|
zone (or node (get-string options :zone))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user