From 7fe0794c63ae53db7917889a0230acb9f289fbb9 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Tue, 12 Jun 2012 13:11:36 +0200 Subject: [PATCH] feature #1223: Add kvm attach_disk and detach_disk remote scripts --- src/vmm_mad/remotes/kvm/attach_disk | 29 +++++++++++++++++++++++++++++ src/vmm_mad/remotes/kvm/detach_disk | 28 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 src/vmm_mad/remotes/kvm/attach_disk create mode 100755 src/vmm_mad/remotes/kvm/detach_disk diff --git a/src/vmm_mad/remotes/kvm/attach_disk b/src/vmm_mad/remotes/kvm/attach_disk new file mode 100755 index 0000000000..995c63c47b --- /dev/null +++ b/src/vmm_mad/remotes/kvm/attach_disk @@ -0,0 +1,29 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, 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. # +#--------------------------------------------------------------------------- # + +source $(dirname $0)/kvmrc +source $(dirname $0)/../../scripts_common.sh + +DOMAIN="$1" +SOURCE="$2" +TARGET="$3" + +ATTACH_PARAMS="--domain $DOMAIN --source $SOURCE --target $TARGET" + +exec_and_log "virsh --connect $LIBVIRT_URI attach-disk $ATTACH_PARAMS" \ + "Could not attach $SOURCE ($TARGET) to $DOMAIN" diff --git a/src/vmm_mad/remotes/kvm/detach_disk b/src/vmm_mad/remotes/kvm/detach_disk new file mode 100755 index 0000000000..b270dfcd1a --- /dev/null +++ b/src/vmm_mad/remotes/kvm/detach_disk @@ -0,0 +1,28 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2012, 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. # +#--------------------------------------------------------------------------- # + +source $(dirname $0)/kvmrc +source $(dirname $0)/../../scripts_common.sh + +DOMAIN="$1" +TARGET="$2" + +DETACH_PARAMS="--domain $DOMAIN --target $TARGET" + +exec_and_log "virsh --connect $LIBVIRT_URI detach-disk $DETACH_PARAMS" \ + "Could not detach $TARGET from $DOMAIN"