Last active
December 31, 2015 12:18
-
-
Save itaifrenkel/7984834 to your computer and use it in GitHub Desktop.
Cloudify cloud driver access from recipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following recipe snippet shows custom commands that forward the requests to the network cloud driver | |
// See also: | |
// https://github.com/CloudifySource/Cloudify-iTests/blob/master/src/main/resources/apps/USM/usm/networks/openstack/floatingips/floatingips-service.groovy | |
customCommands ([ | |
"getMachineIp" : { return context.getPrivateAddress() }, | |
"getPublicAddress" : { return context.getPublicAddress() }, | |
"getFloatingIp" : { return context.attributes.thisInstance["floatingIp"] }, | |
"getApplicationNetworkIp" : { return System.getenv()['CLOUDIFY_APPLICATION_NETWORK_IP'] }, | |
"assignFloatingIp" : { | |
// allocate and assigning new floating ip | |
def floatingIp = context.getNetwork().allocateFloatingIP("network_ext", null) | |
def machineIp = context.getPrivateAddress() | |
context.getNetwork().assignFloatingIP(machineIp, floatingIp, null) | |
context.attributes.thisInstance["floatingIp"] = "${floatingIp}" | |
return floatingIp | |
} | |
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following recipe snippet shows a call to the storage cloud driver from the postStart hook | |
// See also: | |
// https://github.com/CloudifySource/Cloudify-iTests/blob/master/src/main/resources/apps/USM/usm/dynamicstorage/create-and-attach/groovy-service.groovy | |
postStart { | |
//Create, attach, format and mount a new storage volume | |
volumeId = context.storage.createVolume("SMALL_BLOCK") | |
context.storage.attachVolume(volumeId, device) | |
context.storage.format(device, fs) | |
context.storage.mount(device, path) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment