knife-ovmcli 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b392fc5de09cd159162052e0e70e2e2c3395757
|
4
|
+
data.tar.gz: 61024e6d44d3a9b5fd52c7ed9574d8ec0eae03b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1134edb619229bf2be45be0d9ccdf5c568bb8428467694d08c629197ec81e419cb109d4d52b8c242bac4e0cc83641f44f0766248868d66d33d535acccb254cc
|
7
|
+
data.tar.gz: d9030d249ca3ff5694ba1b46b25154fb50c6505131b7a873026de4513e3dcbad10cc03147f59f652489f3b0ad826f7eb9adaac8c1b4f502846804bebce1e4ff3
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Geoff O'Callaghan (<geoffocallaghan@gmail.com>)
|
3
|
-
# Contributor::
|
3
|
+
# Contributor:: Michael Huisman michhuis@gmail.com
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'chef/knife'
|
8
8
|
|
9
|
-
# Base class for
|
9
|
+
# Base class for OracleVM knife commands
|
10
10
|
class Chef
|
11
11
|
class Knife
|
12
12
|
class BaseOraclevmCommand < Knife
|
@@ -413,6 +413,54 @@ class Chef
|
|
413
413
|
return current
|
414
414
|
end
|
415
415
|
#
|
416
|
+
# create_vdisk, create vdisk
|
417
|
+
#
|
418
|
+
def create_vdisk(vdisk, size, sparse, reposotory)
|
419
|
+
current = {:errormsg => "", :status => "", :time => "", :vmstatus => ""}
|
420
|
+
|
421
|
+
conn_opts=get_cli_connection
|
422
|
+
Chef::Log.debug("#{conn_opts[:host]}...create vdisk name=#{vdisk},#{size},#{sparse},#{reposotory}")
|
423
|
+
Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|
|
424
|
+
output = ssh.exec!("create VirtualDisk name=#{vdisk} size=#{size} sparse=#{sparse} shareable=No on Repository name=#{reposotory}")
|
425
|
+
output.each_line do |line|
|
426
|
+
if line.match(/Status:/)
|
427
|
+
current[:status]=line.split[1].strip
|
428
|
+
elsif line.match(/Time:/)
|
429
|
+
line["Time: "]=""
|
430
|
+
current[:time]=line.strip
|
431
|
+
elsif line.match(/Error Msg:/)
|
432
|
+
line["Error Msg: "]=""
|
433
|
+
current[:errormsg]=line.strip
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
return current
|
438
|
+
end
|
439
|
+
#
|
440
|
+
# add_vdisk, add vdisk
|
441
|
+
#
|
442
|
+
def add_vdisk(vmname, slot, vdisk)
|
443
|
+
current = {:errormsg => "", :status => "", :time => "", :vmstatus => ""}
|
444
|
+
|
445
|
+
conn_opts=get_cli_connection
|
446
|
+
Chef::Log.debug("#{conn_opts[:host]}...add vdisk name=#{vmname},#{slot},#{vdisk}")
|
447
|
+
Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|
|
448
|
+
output = ssh.exec!("create VmDiskMapping slot=#{slot} virtualDisk=#{vdisk} name=#{vdisk} on Vm name=#{vmname}")
|
449
|
+
output.each_line do |line|
|
450
|
+
if line.match(/Status:/)
|
451
|
+
current[:status]=line.split[1].strip
|
452
|
+
elsif line.match(/Time:/)
|
453
|
+
line["Time: "]=""
|
454
|
+
current[:time]=line.strip
|
455
|
+
elsif line.match(/Error Msg:/)
|
456
|
+
line["Error Msg: "]=""
|
457
|
+
current[:errormsg]=line.strip
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
return current
|
462
|
+
end
|
463
|
+
#
|
416
464
|
# edit_vm, edit VM cpu and memory
|
417
465
|
#
|
418
466
|
def edit_vm(vmname, memory, memorylimit, cpucount, cpucountlimit)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Code copied from Author:: Geoff O'Callaghan (<geoffocallaghan@gmail.com>)
|
3
|
+
# Author:: Michael Huisman michhuis@gmail.com
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'chef/knife'
|
8
|
+
require 'chef/knife/BaseOraclevmCommand'
|
9
|
+
require 'netaddr'
|
10
|
+
require 'net/ssh'
|
11
|
+
|
12
|
+
# Create a virtual disk
|
13
|
+
class Chef::Knife::OvmcliVmAddvdisk < Chef::Knife::BaseOraclevmCommand
|
14
|
+
|
15
|
+
banner "knife ovmcli vm addvdisk VMNAME (options)"
|
16
|
+
|
17
|
+
option :slot,
|
18
|
+
:short => "-s VALUE",
|
19
|
+
:long => "--slot VALUE",
|
20
|
+
:description => "The slot number for the disk in the virtual machine."
|
21
|
+
|
22
|
+
option :vdisk,
|
23
|
+
:short => "-d VALUE",
|
24
|
+
:long => "--vdisk VALUE",
|
25
|
+
:description => "The name or ID of the virtual disk"
|
26
|
+
|
27
|
+
get_common_options
|
28
|
+
|
29
|
+
def run
|
30
|
+
|
31
|
+
$stdout.sync = true
|
32
|
+
|
33
|
+
vmname = @name_args[0]
|
34
|
+
|
35
|
+
slot=get_config(:slot)
|
36
|
+
vdisk=get_config(:vdisk)
|
37
|
+
|
38
|
+
current=add_vdisk(vmname, slot, vdisk)
|
39
|
+
Chef::Log.debug("Status = #{current[:status]}. Time = #{current[:time]}. VM Status = #{current[:vmstatus]}.")
|
40
|
+
|
41
|
+
if current[:status]!="Success"
|
42
|
+
puts "Call to OVM CLI Failed with #{current[:errormsg]}"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Code copied from Author:: Geoff O'Callaghan (<geoffocallaghan@gmail.com>)
|
3
|
+
# Author:: Michael Huisman michhuis@gmail.com
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'chef/knife'
|
8
|
+
require 'chef/knife/BaseOraclevmCommand'
|
9
|
+
require 'netaddr'
|
10
|
+
require 'net/ssh'
|
11
|
+
|
12
|
+
# Create a virtual disk
|
13
|
+
class Chef::Knife::OvmcliVmCreatevdisk < Chef::Knife::BaseOraclevmCommand
|
14
|
+
|
15
|
+
banner "knife ovmcli vm createvdisk VDISK (options)"
|
16
|
+
|
17
|
+
option :size,
|
18
|
+
:short => "-s VALUE",
|
19
|
+
:long => "--size VALUE",
|
20
|
+
:description => "The size of the virtual disk in GiB. "
|
21
|
+
|
22
|
+
option :sparse,
|
23
|
+
:short => "-p VALUE",
|
24
|
+
:long => "--sparse VALUE",
|
25
|
+
:description => "Whether to create a sparse or non-sparse virtual disk Yes or No"
|
26
|
+
|
27
|
+
option :reposotory,
|
28
|
+
:short => "-r VALUE",
|
29
|
+
:long => "--reposotory VALUE",
|
30
|
+
:description => "The name of the reposotory where the disk will be created"
|
31
|
+
|
32
|
+
get_common_options
|
33
|
+
|
34
|
+
def run
|
35
|
+
|
36
|
+
$stdout.sync = true
|
37
|
+
|
38
|
+
vdisk = @name_args[0]
|
39
|
+
|
40
|
+
size=get_config(:size)
|
41
|
+
sparse=get_config(:sparse)
|
42
|
+
reposotory=get_config(:reposotory)
|
43
|
+
|
44
|
+
current=create_vdisk(vdisk, size, sparse, reposotory)
|
45
|
+
Chef::Log.debug("Status = #{current[:status]}. Time = #{current[:time]}. VM Status = #{current[:vmstatus]}.")
|
46
|
+
|
47
|
+
if current[:status]!="Success"
|
48
|
+
puts "Call to OVM CLI Failed with #{current[:errormsg]}"
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
data/lib/knife-ovmcli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-ovmcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff O'Callaghan / Michael Huisman
|
@@ -47,15 +47,17 @@ files:
|
|
47
47
|
- lib/chef/knife/BaseOraclevmCommand.rb
|
48
48
|
- lib/chef/knife/ovmcli_serverpool_list.rb
|
49
49
|
- lib/chef/knife/ovmcli_tag_list.rb
|
50
|
+
- lib/chef/knife/ovmcli_vm_addvdisk.rb
|
50
51
|
- lib/chef/knife/ovmcli_vm_addvnic.rb
|
51
52
|
- lib/chef/knife/ovmcli_vm_clone.rb
|
53
|
+
- lib/chef/knife/ovmcli_vm_createvdisk.rb
|
52
54
|
- lib/chef/knife/ovmcli_vm_delete.rb
|
53
55
|
- lib/chef/knife/ovmcli_vm_edit.rb
|
54
56
|
- lib/chef/knife/ovmcli_vm_list.rb
|
55
57
|
- lib/chef/knife/ovmcli_vm_message.rb
|
56
58
|
- lib/chef/knife/ovmcli_vm_state.rb
|
57
59
|
- lib/knife-ovmcli/version.rb
|
58
|
-
homepage: http://github.com/michaelhuisman/knife-
|
60
|
+
homepage: http://github.com/michaelhuisman/knife-ovmcli
|
59
61
|
licenses: []
|
60
62
|
metadata: {}
|
61
63
|
post_install_message:
|