Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def validate
- unless Chef::Config[:knife][:mem] && Chef::Config[:knife][:cpu] && Chef::Config[:knife][:disk_size] && Chef::Config[:knife][:networkUuid] && Chef::Config[:knife][:node_name]
- ui.error('Missing mem, cpu, name or gateway. Use -M (--mem), -C (--cpu), -N (--node-name), -D (--disk-size) and -U (--network-uuid) to set the mandatory values.')
- exit 1
- end
- end
- def run
- validate
- task_list = [
- ui.color('Task ID', :bold)
- ]
- specs = '{
- "name": "'"#{Chef::Config[:knife][:node_name]}"'",
- "memoryMb": "'"#{Chef::Config[:knife][:mem]}"'",
- "numVcpus": "'"#{Chef::Config[:knife][:cpu]}"'",
- "hypervisorType": "Acropolis",
- "description": "Created with knife-acropolis",
- "vmDisks": [
- {
- "isCdrom": false,
- "isEmpty": false,
- "isScsiPassThrough": false,
- "vmDiskCreate": {
- "containerName": "default",
- "sizeMb": "'"#{Chef::Config[:knife][:disk_size]}"'"
- }
- }
- ],
- "vmNics": [
- {
- "networkUuid": "'"#{Chef::Config[:knife][:networkUuid]}"'",
- "requestIp": true
- }
- ]
- }'
- task = post('/vms', specs)
- uuid = JSON.parse(task)
- task_list << uuid['taskUuid'].to_s
- print ui.list(task_list, :uneven_columns_across, 1)
- end
- task = post('/vms', specs)
- uuid = JSON.parse(task)
- task_list << uuid['taskUuid'].to_s
- print ui.list(task_list, :uneven_columns_across, 1)
Add Comment
Please, Sign In to add comment