Skip to content

Commit

Permalink
F #1454: Integrate addon into OpenNebula
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmont committed Jan 18, 2018
1 parent b9cc318 commit b4272f6
Show file tree
Hide file tree
Showing 21 changed files with 1,209 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/im_mad/remotes/one.d/poll
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env ruby

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# -------------------------------------------------------------------------- #

ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)

if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end

$: << RUBY_LIB_LOCATION

require 'opennebula_driver'
host = ARGV[-1]
host_id = ARGV[-2]

one2one_drv = OpenNebulaDriver.new(host, host_id)

one2one_drv.monitor_all_vms

20 changes: 20 additions & 0 deletions src/vmm_mad/remotes/one/attach_disk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #

SCRIPT_NAME=$(basename $0)
echo "Action $SCRIPT_NAME not supported" 1>&2
20 changes: 20 additions & 0 deletions src/vmm_mad/remotes/one/attach_nic
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #

SCRIPT_NAME=$(basename $0)
echo "Action $SCRIPT_NAME not supported" 1>&2
42 changes: 42 additions & 0 deletions src/vmm_mad/remotes/one/cancel
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env ruby

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# -------------------------------------------------------------------------- #

ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)

if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end

$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)

require 'opennebula_driver'

deploy_id = ARGV[0]
host = ARGV[1]
vm_id = ARGV[2]

vm = OpenNebula::VirtualMachine.new_with_id(vm_id, OpenNebula::Client.new)
vm.info

lcm_state = vm.lcm_state_str

one2one_drv = OpenNebulaDriver.new(host)
one2one_drv.cancel(deploy_id, lcm_state)
53 changes: 53 additions & 0 deletions src/vmm_mad/remotes/one/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env ruby

# ---------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ---------------------------------------------------------------------------- #

ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)

if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end

$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)

require 'opennebula_driver'
require 'opennebula'

dfile = ARGV[0]
host = ARGV[1]
id = ARGV[2]

vm = OpenNebula::VirtualMachine.new_with_id(id, OpenNebula::Client.new)
vm.info

lcm_state = vm.lcm_state_str
deploy_id = vm.deploy_id

one2one_drv = OpenNebulaDriver.new(host)

text=File.read(dfile)

begin
puts one2one_drv.deploy(id, host, text, lcm_state, deploy_id)
rescue Exception => e
STDERR.puts "Deploy of VM #{id} on host #{host} with #{dfile} failed " +
"due to \"#{e.message}\""
exit -1
end
20 changes: 20 additions & 0 deletions src/vmm_mad/remotes/one/detach_disk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #

SCRIPT_NAME=$(basename $0)
echo "Action $SCRIPT_NAME not supported" 1>&2
20 changes: 20 additions & 0 deletions src/vmm_mad/remotes/one/detach_nic
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #

SCRIPT_NAME=$(basename $0)
echo "Action $SCRIPT_NAME not supported" 1>&2
20 changes: 20 additions & 0 deletions src/vmm_mad/remotes/one/migrate
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #

SCRIPT_NAME=$(basename $0)
echo "Action $SCRIPT_NAME not supported" 1>&2
20 changes: 20 additions & 0 deletions src/vmm_mad/remotes/one/migrate_local
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# -------------------------------------------------------------------------- #
# Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #

SCRIPT_NAME=$(basename $0)
echo "Action $SCRIPT_NAME not supported" 1>&2
Loading

0 comments on commit b4272f6

Please sign in to comment.