# # Copyright (c) 2014 NetApp, Inc., All Rights Reserved. # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary create_volume - Helper Script for NACLU Trainings ## ## @description Objective: ## This script creates a volume based upon a received message, ## and replies with a message containing the volume name: ## ## @synopsis ## ## this script is not meant to be called directly from ntest but is ## used as a sub process in an automation class exercise. ## ## @dependencies ## This script is to be used as a sub process script to be ## invoked from class script ilt_test.thpl (or similar). ## ## @param AGGR ## (required) name of the aggregate on which to create the volume ## ## @param VSERVER ## (required) name of the vserver for the volume ## ## @param NODES (or FILER, etc) ## (required) need to create command inteface use strict; use NATE::STAF::Peer qw($Parent); use NATE::Log qw(log_global); use NATE::ParamSet; use NACL::C::Node; use NACL::STask::Volume; my $Log = log_global(); # Define parameters, make sure AGGR and VSERVER are passed in my $paramset = NATE::ParamSet->new(); my $aggr_def = { name => 'AGGR', description => 'Aggregate name where volume is to be created', required => 'You must provide an aggregate name', }; my $vserver_def = { name => 'VSERVER', description => 'Vserver associated with to be created volume.', required => 'You must provide a vserver name', }; $paramset->parameters(definitions=>[$aggr_def, $vserver_def]); $paramset->process(); my $VSERVER_NAME = $paramset->get('VSERVER'); my $AGGR_NAME = $paramset->get('AGGR'); $Log->comment('Here is received vserver:' . $VSERVER_NAME . ':' . "\n"); my $src_obj; my $node = NACL::C::Node->find(); my $type = $Parent->message_get(type => 'create_vol'); $src_obj = NACL::STask::Volume->create( command_interface => $node, vserver => $VSERVER_NAME, aggregate => $AGGR_NAME, size => '20M', type => $type, ); my $vol_name = $src_obj->volume(); $Log->comment('Created volume:' . $vol_name); $Parent->message_put( message => $vol_name, type => "create_done");