From dfa86ee3d5aa2c4399dc8780528ea62e79f5fb3a Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Wed, 1 Jun 2011 18:57:47 +0200 Subject: [PATCH] feature #595: changed one_vmm_ssh to one_vmm_exec, sh driver is deleted --- install.sh | 43 +++--- .../{sh/one_vmm_sh => exec/one_vmm_exec} | 4 +- .../one_vmm_ssh.rb => exec/one_vmm_exec.rb} | 6 +- .../vmm_exec_kvm.conf} | 0 .../vmm_exec_xen.conf} | 0 .../{ssh/vmm_sshrc => exec/vmm_execrc} | 0 src/vmm_mad/sh/one_vmm_sh.rb | 129 ------------------ src/vmm_mad/sh/vmm_shrc | 17 --- src/vmm_mad/ssh/one_vmm_ssh | 38 ------ 9 files changed, 23 insertions(+), 214 deletions(-) rename src/vmm_mad/{sh/one_vmm_sh => exec/one_vmm_exec} (94%) rename src/vmm_mad/{ssh/one_vmm_ssh.rb => exec/one_vmm_exec.rb} (97%) rename src/vmm_mad/{ssh/vmm_ssh_kvm.conf => exec/vmm_exec_kvm.conf} (100%) rename src/vmm_mad/{ssh/vmm_ssh_xen.conf => exec/vmm_exec_xen.conf} (100%) rename src/vmm_mad/{ssh/vmm_sshrc => exec/vmm_execrc} (100%) delete mode 100755 src/vmm_mad/sh/one_vmm_sh.rb delete mode 100644 src/vmm_mad/sh/vmm_shrc delete mode 100755 src/vmm_mad/ssh/one_vmm_ssh diff --git a/install.sh b/install.sh index 7e48aaa9d7..d344b57bd7 100755 --- a/install.sh +++ b/install.sh @@ -164,8 +164,7 @@ ETC_DIRS="$ETC_LOCATION/im_kvm \ $ETC_LOCATION/im_xen \ $ETC_LOCATION/im_ec2 \ $ETC_LOCATION/vmm_ec2 \ - $ETC_LOCATION/vmm_ssh \ - $ETC_LOCATION/vmm_sh \ + $ETC_LOCATION/vmm_exec \ $ETC_LOCATION/tm_nfs \ $ETC_LOCATION/tm_ssh \ $ETC_LOCATION/tm_dummy \ @@ -260,12 +259,12 @@ INSTALL_FILES=( IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d IM_PROBES_XEN_FILES:$VAR_LOCATION/remotes/im/xen.d IM_PROBES_GANGLIA_FILES:$VAR_LOCATION/remotes/im/ganglia.d - VMM_SSH_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm - VMM_SSH_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen - VMM_SSH_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll - VMM_SSH_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/xen/poll - VMM_SSH_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll_local - VMM_SSH_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/xen/poll_local + VMM_EXEC_KVM_SCRIPTS:$VAR_LOCATION/remotes/vmm/kvm + VMM_EXEC_XEN_SCRIPTS:$VAR_LOCATION/remotes/vmm/xen + VMM_EXEC_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll + VMM_EXEC_XEN_KVM_POLL:$VAR_LOCATION/remotes/vmm/xen/poll + VMM_EXEC_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/kvm/poll_local + VMM_EXEC_GANGLIA_POLL:$VAR_LOCATION/remotes/vmm/xen/poll_local NFS_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/nfs SSH_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/ssh DUMMY_TM_COMMANDS_LIB_FILES:$LIB_LOCATION/tm_commands/dummy @@ -321,8 +320,7 @@ INSTALL_SUNSTONE_FILES=( INSTALL_ETC_FILES=( ETC_FILES:$ETC_LOCATION VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 - VMM_SSH_ETC_FILES:$ETC_LOCATION/vmm_ssh - VMM_SH_ETC_FILES:$ETC_LOCATION/vmm_sh + VMM_EXEC_ETC_FILES:$ETC_LOCATION/vmm_exec IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2 TM_NFS_ETC_FILES:$ETC_LOCATION/tm_nfs TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh @@ -414,10 +412,8 @@ MAD_RUBY_LIB_FILES="src/mad/ruby/scripts_common.rb" MADS_LIB_FILES="src/mad/sh/madcommon.sh \ src/tm_mad/tm_common.sh \ - src/vmm_mad/ssh/one_vmm_ssh.rb \ - src/vmm_mad/ssh/one_vmm_ssh \ - src/vmm_mad/sh/one_vmm_sh.rb \ - src/vmm_mad/sh/one_vmm_sh \ + src/vmm_mad/exec/one_vmm_exec.rb \ + src/vmm_mad/exec/one_vmm_exec \ src/vmm_mad/ec2/one_vmm_ec2.rb \ src/vmm_mad/ec2/one_vmm_ec2 \ src/vmm_mad/dummy/one_vmm_dummy.rb \ @@ -443,7 +439,7 @@ MADS_LIB_FILES="src/mad/sh/madcommon.sh \ # VMM SH Driver KVM scripts, to be installed under $REMOTES_LOCATION/vmm/kvm #------------------------------------------------------------------------------- -VMM_SSH_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ +VMM_EXEC_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ src/vmm_mad/remotes/kvm/deploy \ src/vmm_mad/remotes/kvm/kvmrc \ src/vmm_mad/remotes/kvm/migrate \ @@ -455,7 +451,7 @@ VMM_SSH_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ # VMM SH Driver Xen scripts, to be installed under $REMOTES_LOCATION/vmm/xen #------------------------------------------------------------------------------- -VMM_SSH_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ +VMM_EXEC_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ src/vmm_mad/remotes/xen/deploy \ src/vmm_mad/remotes/xen/xenrc \ src/vmm_mad/remotes/xen/migrate \ @@ -467,8 +463,8 @@ VMM_SSH_XEN_SCRIPTS="src/vmm_mad/remotes/xen/cancel \ # VMM SH Driver xen/kvm scripts, to be installed under $REMOTES_LOCATION/vmm/* #----------------------------------------------------------------------------- -VMM_SSH_XEN_KVM_POLL="src/vmm_mad/remotes/poll_xen_kvm.rb" -VMM_SSH_GANGLIA_POLL="src/vmm_mad/remotes/poll_ganglia.rb" +VMM_EXEC_XEN_KVM_POLL="src/vmm_mad/remotes/poll_xen_kvm.rb" +VMM_EXEC_GANGLIA_POLL="src/vmm_mad/remotes/poll_ganglia.rb" #------------------------------------------------------------------------------- # Information Manager Probes, to be installed under $LIB_LOCATION/remotes @@ -548,18 +544,15 @@ ETC_FILES="share/etc/oned.conf \ #------------------------------------------------------------------------------- # Virtualization drivers config. files, to be installed under $ETC_LOCATION # - ec2, $ETC_LOCATION/vmm_ec2 -# - sh, $ETC_LOCATION/vmm_sh -# - ssh, $ETC_LOCATION/vmm_ssh +# - ssh, $ETC_LOCATION/vmm_exec #------------------------------------------------------------------------------- VMM_EC2_ETC_FILES="src/vmm_mad/ec2/vmm_ec2rc \ src/vmm_mad/ec2/vmm_ec2.conf" -VMM_SSH_ETC_FILES="src/vmm_mad/ssh/vmm_sshrc \ - src/vmm_mad/ssh/vmm_ssh_kvm.conf \ - src/vmm_mad/ssh/vmm_ssh_xen.conf" - -VMM_SH_ETC_FILES="src/vmm_mad/sh/vmm_shrc" +VMM_EXEC_ETC_FILES="src/vmm_mad/exec/vmm_execrc \ + src/vmm_mad/exec/vmm_exec_kvm.conf \ + src/vmm_mad/exec/vmm_exec_xen.conf" #------------------------------------------------------------------------------- # Information drivers config. files, to be installed under $ETC_LOCATION diff --git a/src/vmm_mad/sh/one_vmm_sh b/src/vmm_mad/exec/one_vmm_exec similarity index 94% rename from src/vmm_mad/sh/one_vmm_sh rename to src/vmm_mad/exec/one_vmm_exec index 4195ef2e63..cc708d183d 100755 --- a/src/vmm_mad/sh/one_vmm_sh +++ b/src/vmm_mad/exec/one_vmm_exec @@ -17,11 +17,11 @@ #--------------------------------------------------------------------------- # if [ -z "${ONE_LOCATION}" ]; then - DRIVERRC=/etc/one/vmm_sh/vmm_shrc + DRIVERRC=/etc/one/vmm_exec/vmm_execrc MADCOMMON=/usr/lib/one/mads/madcommon.sh VAR_LOCATION=/var/lib/one else - DRIVERRC=$ONE_LOCATION/etc/vmm_sh/vmm_shrc + DRIVERRC=$ONE_LOCATION/etc/vmm_exec/vmm_execrc MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh VAR_LOCATION=$ONE_LOCATION/var fi diff --git a/src/vmm_mad/ssh/one_vmm_ssh.rb b/src/vmm_mad/exec/one_vmm_exec.rb similarity index 97% rename from src/vmm_mad/ssh/one_vmm_ssh.rb rename to src/vmm_mad/exec/one_vmm_exec.rb index 57a13ddb83..fff1872265 100755 --- a/src/vmm_mad/ssh/one_vmm_ssh.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -35,7 +35,7 @@ require "VirtualMachineDriver" require 'getoptlong' # The main class for the Sh driver -class SshDriver < VirtualMachineDriver +class ExecDriver < VirtualMachineDriver # SshDriver constructor def initialize(hypervisor, options={}) @@ -132,9 +132,9 @@ else exit(-1) end -ssh_driver = SshDriver.new(hypervisor, +exec_driver = ExecDriver.new(hypervisor, :concurrency => threads, :retries => retries, :local_actions => local_actions) -ssh_driver.start_driver +exec_driver.start_driver diff --git a/src/vmm_mad/ssh/vmm_ssh_kvm.conf b/src/vmm_mad/exec/vmm_exec_kvm.conf similarity index 100% rename from src/vmm_mad/ssh/vmm_ssh_kvm.conf rename to src/vmm_mad/exec/vmm_exec_kvm.conf diff --git a/src/vmm_mad/ssh/vmm_ssh_xen.conf b/src/vmm_mad/exec/vmm_exec_xen.conf similarity index 100% rename from src/vmm_mad/ssh/vmm_ssh_xen.conf rename to src/vmm_mad/exec/vmm_exec_xen.conf diff --git a/src/vmm_mad/ssh/vmm_sshrc b/src/vmm_mad/exec/vmm_execrc similarity index 100% rename from src/vmm_mad/ssh/vmm_sshrc rename to src/vmm_mad/exec/vmm_execrc diff --git a/src/vmm_mad/sh/one_vmm_sh.rb b/src/vmm_mad/sh/one_vmm_sh.rb deleted file mode 100755 index eaf907cf53..0000000000 --- a/src/vmm_mad/sh/one_vmm_sh.rb +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env ruby - -# -------------------------------------------------------------------------- # -# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # -# # -# 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. # -#--------------------------------------------------------------------------- # - -# ---------------------------------------------------------------------------- # -# Set up the environment for the driver # -# ---------------------------------------------------------------------------- # - -ONE_LOCATION = ENV["ONE_LOCATION"] - -if !ONE_LOCATION - RUBY_LIB_LOCATION = "/usr/lib/one/ruby" - VAR_LOCATION = "/var/lib/one" -else - RUBY_LIB_LOCATION = ONE_LOCATION + "/lib/ruby" - VAR_LOCATION = ONE_LOCATION + "/var" -end - -$: << RUBY_LIB_LOCATION - -require "VirtualMachineDriver" -require 'getoptlong' - -# ---------------------------------------------------------------------------- # -# The main class for the Sh driver # -# ---------------------------------------------------------------------------- # -class ShDriver < VirtualMachineDriver - # ------------------------------------------------------------------------ # - # ShDriver constructor # - # ------------------------------------------------------------------------ # - def initialize(hypervisor,threads) - super(threads,true) - - @config = read_configuration - @hypervisor = hypervisor - - @actions_path = "#{VAR_LOCATION}/remotes/vmm/#{hypervisor}" - end - - # ------------------------------------------------------------------------ # - # DEPLOY action, sends the deployment file to remote host # - # ------------------------------------------------------------------------ # - def deploy(id, host, remote_dfile, not_used) - local_dfile = get_local_deployment_file(remote_dfile) - - if !local_dfile || File.zero?(local_dfile) - send_message(ACTION[:deploy],RESULT[:failure],id, - "Can not open deployment file #{local_dfile}") - return - end - - local_action("#{@actions_path}/deploy #{host} #{local_dfile}",id,:deploy) - end - - # ------------------------------------------------------------------------ # - # Basic Domain Management Operations # - # ------------------------------------------------------------------------ # - def shutdown(id, host, deploy_id, not_used) - local_action("#{@actions_path}/shutdown #{host} #{deploy_id}", id, - :shutdown) - end - - def cancel(id, host, deploy_id, not_used) - local_action("#{@actions_path}/cancel #{host} #{deploy_id}", id, :cancel) - end - - def save(id, host, deploy_id, file) - local_action("#{@actions_path}/save #{host} #{deploy_id} #{file}", id, - :save) - end - - def restore(id, host, deploy_id, file) - local_action("#{@actions_path}/restore #{host} #{file}", id, :restore) - end - - def migrate(id, host, deploy_id, dest_host) - local_action( - "#{@actions_path}/migrate #{host} #{deploy_id} #{dest_host}", id, - :migrate) - end - - def poll(id, host, deploy_id, not_used) - local_action("#{@actions_path}/poll #{host} #{deploy_id}",id,:poll) - end -end - -# ---------------------------------------------------------------------------- # -# ShDriver Main program # -# ---------------------------------------------------------------------------- # -opts = GetoptLong.new( - [ '--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT ] -) - -hypervisor = '' -threads = 15 - -begin - opts.each do |opt, arg| - case opt - when '--threads' - threads = arg.to_i - end - end -rescue Exception => e - exit(-1) -end - -if ARGV.length >= 1 - hypervisor = ARGV.shift -else - exit(-1) -end - -sh_driver = ShDriver.new(hypervisor,threads) -sh_driver.start_driver diff --git a/src/vmm_mad/sh/vmm_shrc b/src/vmm_mad/sh/vmm_shrc deleted file mode 100644 index a5a589db4c..0000000000 --- a/src/vmm_mad/sh/vmm_shrc +++ /dev/null @@ -1,17 +0,0 @@ -# -------------------------------------------------------------------------- # -# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # -# # -# 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. # -#--------------------------------------------------------------------------- # - - diff --git a/src/vmm_mad/ssh/one_vmm_ssh b/src/vmm_mad/ssh/one_vmm_ssh deleted file mode 100755 index f74d61ef66..0000000000 --- a/src/vmm_mad/ssh/one_vmm_ssh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # -# # -# 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. # -#--------------------------------------------------------------------------- # - -if [ -z "${ONE_LOCATION}" ]; then - DRIVERRC=/etc/one/vmm_ssh/vmm_sshrc - MADCOMMON=/usr/lib/one/mads/madcommon.sh - VAR_LOCATION=/var/lib/one -else - DRIVERRC=$ONE_LOCATION/etc/vmm_ssh/vmm_sshrc - MADCOMMON=$ONE_LOCATION/lib/mads/madcommon.sh - VAR_LOCATION=$ONE_LOCATION/var -fi - -. $MADCOMMON - -# Export the vmm_mad specific rc -export_rc_vars $DRIVERRC - -# Go to ONE_LOCATION -cd $VAR_LOCATION - -# Execute the actual MAD -execute_mad $*