diff --git a/install.sh b/install.sh index 1af03e6bf3..5709d814a2 100755 --- a/install.sh +++ b/install.sh @@ -874,7 +874,8 @@ TM_SHARED_FILES="src/tm_mad/shared/clone \ src/tm_mad/shared/snap_delete \ src/tm_mad/shared/snap_revert \ src/tm_mad/shared/monitor \ - src/tm_mad/shared/cpds" + src/tm_mad/shared/cpds \ + src/tm_mad/shared/resize" TM_FS_LVM_FILES="src/tm_mad/fs_lvm/clone \ src/tm_mad/fs_lvm/context \ @@ -910,7 +911,8 @@ TM_QCOW2_FILES="src/tm_mad/qcow2/clone \ src/tm_mad/qcow2/snap_create_live \ src/tm_mad/qcow2/snap_delete \ src/tm_mad/qcow2/snap_revert \ - src/tm_mad/qcow2/cpds" + src/tm_mad/qcow2/cpds \ + src/tm_mad/qcow2/resize" TM_SSH_FILES="src/tm_mad/ssh/clone \ src/tm_mad/ssh/delete \ @@ -929,7 +931,8 @@ TM_SSH_FILES="src/tm_mad/ssh/clone \ src/tm_mad/ssh/snap_revert \ src/tm_mad/ssh/monitor \ src/tm_mad/ssh/monitor_ds \ - src/tm_mad/ssh/cpds" + src/tm_mad/ssh/cpds \ + src/tm_mad/ssh/resize" TM_DUMMY_FILES="src/tm_mad/dummy/clone \ src/tm_mad/dummy/delete \ diff --git a/src/tm_mad/common/resize b/src/tm_mad/common/resize new file mode 100755 index 0000000000..1cdf9ef024 --- /dev/null +++ b/src/tm_mad/common/resize @@ -0,0 +1,39 @@ +#!/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. # +#--------------------------------------------------------------------------- # + +# resize image size vmid + +SRC=$1 +SIZE=$2 +VMID=$3 + +if [ -z "${ONE_LOCATION}" ]; then + TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh + DATASTORES=/var/lib/one/datastores +else + TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh + DATASTORES=$ONE_LOCATION/var/datastores +fi + +. $TMCOMMON + +SRC_PATH=$(arg_path $SRC) +SRC_HOST=$(arg_host $SRC) + +ssh_exec_and_log "${SRC_HOST}" "qemu-img resize ${SRC_PATH} ${SIZE}M" \ + "Error resizing image ${SRC_PATH}" diff --git a/src/tm_mad/qcow2/resize b/src/tm_mad/qcow2/resize new file mode 120000 index 0000000000..a5949c186e --- /dev/null +++ b/src/tm_mad/qcow2/resize @@ -0,0 +1 @@ +../common/resize \ No newline at end of file diff --git a/src/tm_mad/shared/resize b/src/tm_mad/shared/resize new file mode 120000 index 0000000000..a5949c186e --- /dev/null +++ b/src/tm_mad/shared/resize @@ -0,0 +1 @@ +../common/resize \ No newline at end of file diff --git a/src/tm_mad/ssh/resize b/src/tm_mad/ssh/resize new file mode 120000 index 0000000000..a5949c186e --- /dev/null +++ b/src/tm_mad/ssh/resize @@ -0,0 +1 @@ +../common/resize \ No newline at end of file