From adeff7a75146bf0e44daf513db72bd30f3a166bb Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Thu, 7 Apr 2016 11:02:12 +0200 Subject: [PATCH] Remove VMware drivers --- install.sh | 77 --- share/doc/xsd/oned.conf | 8 +- share/etc/oned.conf | 49 +- src/datastore_mad/remotes/common/stat | 3 +- src/datastore_mad/remotes/vmfs/clone | 121 ----- src/datastore_mad/remotes/vmfs/cp | 174 ------ src/datastore_mad/remotes/vmfs/mkfs | 123 ----- src/datastore_mad/remotes/vmfs/monitor | 86 --- src/datastore_mad/remotes/vmfs/rm | 87 --- src/datastore_mad/remotes/vmfs/snap_delete | 1 - src/datastore_mad/remotes/vmfs/snap_flatten | 1 - src/datastore_mad/remotes/vmfs/snap_revert | 1 - src/datastore_mad/remotes/vmfs/stat | 1 - src/datastore_mad/remotes/vmfs/vmfs.conf | 21 - src/im_mad/remotes/vmware.d/vmware.rb | 45 -- src/mad/sh/scripts_common.sh | 15 - src/tm_mad/common/context | 4 - src/tm_mad/vmfs/clone | 99 ---- src/tm_mad/vmfs/context | 1 - src/tm_mad/vmfs/cpds | 1 - src/tm_mad/vmfs/delete | 60 -- src/tm_mad/vmfs/failmigrate | 1 - src/tm_mad/vmfs/ln | 95 ---- src/tm_mad/vmfs/mkimage | 75 --- src/tm_mad/vmfs/mkswap | 1 - src/tm_mad/vmfs/mv | 1 - src/tm_mad/vmfs/mvds | 19 - src/tm_mad/vmfs/postmigrate | 1 - src/tm_mad/vmfs/premigrate | 1 - src/tm_mad/vmfs/snap_create | 1 - src/tm_mad/vmfs/snap_create_live | 1 - src/tm_mad/vmfs/snap_delete | 1 - src/tm_mad/vmfs/snap_revert | 1 - src/vmm_mad/exec/one_vmm_exec.rb | 6 - src/vmm_mad/exec/vmm_exec_vmware.conf | 30 - src/vmm_mad/remotes/vmware/attach_disk | 43 -- src/vmm_mad/remotes/vmware/attach_nic | 42 -- src/vmm_mad/remotes/vmware/cancel | 37 -- src/vmm_mad/remotes/vmware/checkpoint | 1 - src/vmm_mad/remotes/vmware/deploy | 40 -- src/vmm_mad/remotes/vmware/detach_disk | 34 -- src/vmm_mad/remotes/vmware/detach_nic | 41 -- src/vmm_mad/remotes/vmware/migrate | 38 -- src/vmm_mad/remotes/vmware/poll | 38 -- src/vmm_mad/remotes/vmware/reboot | 37 -- src/vmm_mad/remotes/vmware/reset | 43 -- src/vmm_mad/remotes/vmware/restore | 37 -- src/vmm_mad/remotes/vmware/save | 38 -- .../remotes/vmware/scripts_common_sh.sh | 59 -- src/vmm_mad/remotes/vmware/shutdown | 57 -- src/vmm_mad/remotes/vmware/snapshot_create | 40 -- src/vmm_mad/remotes/vmware/snapshot_delete | 38 -- src/vmm_mad/remotes/vmware/snapshot_revert | 38 -- src/vmm_mad/remotes/vmware/vi_driver.rb | 513 ------------------ src/vmm_mad/remotes/vmware/vmware_driver.rb | 429 --------------- src/vmm_mad/remotes/vmware/vmwarerc | 30 - src/vnm_mad/remotes/lib/nic.rb | 18 - src/vnm_mad/remotes/vmware/VMware.rb | 114 ---- src/vnm_mad/remotes/vmware/clean | 19 - src/vnm_mad/remotes/vmware/post | 19 - src/vnm_mad/remotes/vmware/pre | 30 - src/vnm_mad/remotes/vmware/update_sg | 21 - 62 files changed, 7 insertions(+), 3099 deletions(-) delete mode 100755 src/datastore_mad/remotes/vmfs/clone delete mode 100755 src/datastore_mad/remotes/vmfs/cp delete mode 100755 src/datastore_mad/remotes/vmfs/mkfs delete mode 100755 src/datastore_mad/remotes/vmfs/monitor delete mode 100755 src/datastore_mad/remotes/vmfs/rm delete mode 120000 src/datastore_mad/remotes/vmfs/snap_delete delete mode 120000 src/datastore_mad/remotes/vmfs/snap_flatten delete mode 120000 src/datastore_mad/remotes/vmfs/snap_revert delete mode 120000 src/datastore_mad/remotes/vmfs/stat delete mode 100644 src/datastore_mad/remotes/vmfs/vmfs.conf delete mode 100755 src/im_mad/remotes/vmware.d/vmware.rb delete mode 100755 src/tm_mad/vmfs/clone delete mode 120000 src/tm_mad/vmfs/context delete mode 120000 src/tm_mad/vmfs/cpds delete mode 100755 src/tm_mad/vmfs/delete delete mode 120000 src/tm_mad/vmfs/failmigrate delete mode 100755 src/tm_mad/vmfs/ln delete mode 100755 src/tm_mad/vmfs/mkimage delete mode 120000 src/tm_mad/vmfs/mkswap delete mode 120000 src/tm_mad/vmfs/mv delete mode 100755 src/tm_mad/vmfs/mvds delete mode 120000 src/tm_mad/vmfs/postmigrate delete mode 120000 src/tm_mad/vmfs/premigrate delete mode 120000 src/tm_mad/vmfs/snap_create delete mode 120000 src/tm_mad/vmfs/snap_create_live delete mode 120000 src/tm_mad/vmfs/snap_delete delete mode 120000 src/tm_mad/vmfs/snap_revert delete mode 100644 src/vmm_mad/exec/vmm_exec_vmware.conf delete mode 100755 src/vmm_mad/remotes/vmware/attach_disk delete mode 100755 src/vmm_mad/remotes/vmware/attach_nic delete mode 100755 src/vmm_mad/remotes/vmware/cancel delete mode 100644 src/vmm_mad/remotes/vmware/checkpoint delete mode 100755 src/vmm_mad/remotes/vmware/deploy delete mode 100755 src/vmm_mad/remotes/vmware/detach_disk delete mode 100755 src/vmm_mad/remotes/vmware/detach_nic delete mode 100755 src/vmm_mad/remotes/vmware/migrate delete mode 100755 src/vmm_mad/remotes/vmware/poll delete mode 100755 src/vmm_mad/remotes/vmware/reboot delete mode 100755 src/vmm_mad/remotes/vmware/reset delete mode 100755 src/vmm_mad/remotes/vmware/restore delete mode 100755 src/vmm_mad/remotes/vmware/save delete mode 100644 src/vmm_mad/remotes/vmware/scripts_common_sh.sh delete mode 100755 src/vmm_mad/remotes/vmware/shutdown delete mode 100755 src/vmm_mad/remotes/vmware/snapshot_create delete mode 100755 src/vmm_mad/remotes/vmware/snapshot_delete delete mode 100755 src/vmm_mad/remotes/vmware/snapshot_revert delete mode 100644 src/vmm_mad/remotes/vmware/vi_driver.rb delete mode 100644 src/vmm_mad/remotes/vmware/vmware_driver.rb delete mode 100644 src/vmm_mad/remotes/vmware/vmwarerc delete mode 100644 src/vnm_mad/remotes/vmware/VMware.rb delete mode 100755 src/vnm_mad/remotes/vmware/clean delete mode 100755 src/vnm_mad/remotes/vmware/post delete mode 100755 src/vnm_mad/remotes/vmware/pre delete mode 100755 src/vnm_mad/remotes/vmware/update_sg diff --git a/install.sh b/install.sh index eee94772e9..98e66d62fd 100755 --- a/install.sh +++ b/install.sh @@ -242,14 +242,12 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/im \ $VAR_LOCATION/remotes/im/kvm.d \ $VAR_LOCATION/remotes/im/kvm-probes.d \ - $VAR_LOCATION/remotes/im/vmware.d \ $VAR_LOCATION/remotes/im/vcenter.d \ $VAR_LOCATION/remotes/im/ec2.d \ $VAR_LOCATION/remotes/im/sl.d \ $VAR_LOCATION/remotes/im/az.d \ $VAR_LOCATION/remotes/vmm \ $VAR_LOCATION/remotes/vmm/kvm \ - $VAR_LOCATION/remotes/vmm/vmware \ $VAR_LOCATION/remotes/vmm/vcenter \ $VAR_LOCATION/remotes/vmm/ec2 \ $VAR_LOCATION/remotes/vmm/sl \ @@ -262,14 +260,12 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/vnm/fw \ $VAR_LOCATION/remotes/vnm/ovswitch \ $VAR_LOCATION/remotes/vnm/ovswitch_brcompat \ - $VAR_LOCATION/remotes/vnm/vmware \ $VAR_LOCATION/remotes/tm/ \ $VAR_LOCATION/remotes/tm/dummy \ $VAR_LOCATION/remotes/tm/shared \ $VAR_LOCATION/remotes/tm/fs_lvm \ $VAR_LOCATION/remotes/tm/qcow2 \ $VAR_LOCATION/remotes/tm/ssh \ - $VAR_LOCATION/remotes/tm/vmfs \ $VAR_LOCATION/remotes/tm/lvm \ $VAR_LOCATION/remotes/tm/ceph \ $VAR_LOCATION/remotes/tm/dev \ @@ -280,7 +276,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/datastore \ $VAR_LOCATION/remotes/datastore/dummy \ $VAR_LOCATION/remotes/datastore/fs \ - $VAR_LOCATION/remotes/datastore/vmfs \ $VAR_LOCATION/remotes/datastore/lvm \ $VAR_LOCATION/remotes/datastore/ceph \ $VAR_LOCATION/remotes/datastore/dev \ @@ -377,7 +372,6 @@ INSTALL_FILES=( IM_PROBES_FILES:$VAR_LOCATION/remotes/im IM_PROBES_KVM_FILES:$VAR_LOCATION/remotes/im/kvm.d IM_PROBES_KVM_PROBES_FILES:$VAR_LOCATION/remotes/im/kvm-probes.d - IM_PROBES_VMWARE_FILES:$VAR_LOCATION/remotes/im/vmware.d IM_PROBES_VCENTER_FILES:$VAR_LOCATION/remotes/im/vcenter.d IM_PROBES_EC2_FILES:$VAR_LOCATION/remotes/im/ec2.d IM_PROBES_SL_FILES:$VAR_LOCATION/remotes/im/sl.d @@ -390,7 +384,6 @@ INSTALL_FILES=( AUTH_SERVER_CIPHER_FILES:$VAR_LOCATION/remotes/auth/server_cipher AUTH_DUMMY_FILES:$VAR_LOCATION/remotes/auth/dummy AUTH_PLAIN_FILES:$VAR_LOCATION/remotes/auth/plain - VMM_EXEC_VMWARE_SCRIPTS:$VAR_LOCATION/remotes/vmm/vmware VMM_EXEC_VCENTER_SCRIPTS:$VAR_LOCATION/remotes/vmm/vcenter VMM_EXEC_EC2_SCRIPTS:$VAR_LOCATION/remotes/vmm/ec2 VMM_EXEC_SL_SCRIPTS:$VAR_LOCATION/remotes/vmm/sl @@ -400,7 +393,6 @@ INSTALL_FILES=( TM_FS_LVM_FILES:$VAR_LOCATION/remotes/tm/fs_lvm TM_QCOW2_FILES:$VAR_LOCATION/remotes/tm/qcow2 TM_SSH_FILES:$VAR_LOCATION/remotes/tm/ssh - TM_VMFS_FILES:$VAR_LOCATION/remotes/tm/vmfs TM_LVM_FILES:$VAR_LOCATION/remotes/tm/lvm TM_CEPH_FILES:$VAR_LOCATION/remotes/tm/ceph TM_DEV_FILES:$VAR_LOCATION/remotes/tm/dev @@ -410,7 +402,6 @@ INSTALL_FILES=( DATASTORE_DRIVER_COMMON_SCRIPTS:$VAR_LOCATION/remotes/datastore/ DATASTORE_DRIVER_DUMMY_SCRIPTS:$VAR_LOCATION/remotes/datastore/dummy DATASTORE_DRIVER_FS_SCRIPTS:$VAR_LOCATION/remotes/datastore/fs - DATASTORE_DRIVER_VMFS_SCRIPTS:$VAR_LOCATION/remotes/datastore/vmfs DATASTORE_DRIVER_LVM_SCRIPTS:$VAR_LOCATION/remotes/datastore/lvm DATASTORE_DRIVER_CEPH_SCRIPTS:$VAR_LOCATION/remotes/datastore/ceph DATASTORE_DRIVER_DEV_SCRIPTS:$VAR_LOCATION/remotes/datastore/dev @@ -427,7 +418,6 @@ INSTALL_FILES=( NETWORK_FW_FILES:$VAR_LOCATION/remotes/vnm/fw NETWORK_OVSWITCH_FILES:$VAR_LOCATION/remotes/vnm/ovswitch NETWORK_OVSWITCH_BRCOMPAT_FILES:$VAR_LOCATION/remotes/vnm/ovswitch_brcompat - NETWORK_VMWARE_FILES:$VAR_LOCATION/remotes/vnm/vmware EXAMPLE_SHARE_FILES:$SHARE_LOCATION/examples WEBSOCKIFY_SHARE_FILES:$SHARE_LOCATION/websockify INSTALL_GEMS_SHARE_FILE:$SHARE_LOCATION @@ -533,7 +523,6 @@ INSTALL_ONEFLOW_ETC_FILES=( INSTALL_ETC_FILES=( ETC_FILES:$ETC_LOCATION - VMWARE_ETC_FILES:$ETC_LOCATION EC2_ETC_FILES:$ETC_LOCATION SL_ETC_FILES:$ETC_LOCATION AZ_ETC_FILES:$ETC_LOCATION @@ -678,31 +667,6 @@ VMM_EXEC_KVM_SCRIPTS="src/vmm_mad/remotes/kvm/cancel \ src/vmm_mad/remotes/kvm/reconfigure \ src/vmm_mad/remotes/kvm/prereconfigure" -#------------------------------------------------------------------------------- -# VMM Driver VMWARE scripts, to be installed under $REMOTES_LOCATION/vmm/vmware -#------------------------------------------------------------------------------- - -VMM_EXEC_VMWARE_SCRIPTS="src/vmm_mad/remotes/vmware/cancel \ - src/vmm_mad/remotes/vmware/attach_disk \ - src/vmm_mad/remotes/vmware/detach_disk \ - src/vmm_mad/remotes/vmware/attach_nic \ - src/vmm_mad/remotes/vmware/detach_nic \ - src/vmm_mad/remotes/vmware/snapshot_create \ - src/vmm_mad/remotes/vmware/snapshot_revert \ - src/vmm_mad/remotes/vmware/snapshot_delete \ - src/vmm_mad/remotes/vmware/scripts_common_sh.sh \ - src/vmm_mad/remotes/vmware/deploy \ - src/vmm_mad/remotes/vmware/migrate \ - src/vmm_mad/remotes/vmware/restore \ - src/vmm_mad/remotes/vmware/reboot \ - src/vmm_mad/remotes/vmware/reset \ - src/vmm_mad/remotes/vmware/save \ - src/vmm_mad/remotes/vmware/poll \ - src/vmm_mad/remotes/vmware/checkpoint \ - src/vmm_mad/remotes/vmware/shutdown \ - src/vmm_mad/remotes/vmware/vmware_driver.rb \ - src/vmm_mad/remotes/vmware/vi_driver.rb" - #------------------------------------------------------------------------------- # VMM Driver vCenter scripts, installed under $REMOTES_LOCATION/vmm/vcenter #------------------------------------------------------------------------------- @@ -815,8 +779,6 @@ IM_PROBES_KVM_PROBES_FILES="src/im_mad/remotes/kvm-probes.d/kvm.rb \ src/im_mad/remotes/common.d/version.sh \ src/im_mad/remotes/common.d/collectd-client-shepherd.sh" -IM_PROBES_VMWARE_FILES="src/im_mad/remotes/vmware.d/vmware.rb" - IM_PROBES_VCENTER_FILES="src/im_mad/remotes/vcenter.d/vcenter.rb" IM_PROBES_EC2_FILES="src/im_mad/remotes/ec2.d/poll" @@ -901,12 +863,6 @@ NETWORK_OVSWITCH_BRCOMPAT_FILES="src/vnm_mad/remotes/ovswitch_brcompat/clean \ src/vnm_mad/remotes/ovswitch_brcompat/update_sg \ src/vnm_mad/remotes/ovswitch_brcompat/OpenvSwitch.rb" -NETWORK_VMWARE_FILES="src/vnm_mad/remotes/vmware/clean \ - src/vnm_mad/remotes/vmware/post \ - src/vnm_mad/remotes/vmware/pre \ - src/vnm_mad/remotes/vmware/update_sg \ - src/vnm_mad/remotes/vmware/VMware.rb" - #------------------------------------------------------------------------------- # Transfer Manager commands, to be installed under $LIB_LOCATION/tm_commands # - SHARED TM, $VAR_LOCATION/tm/shared @@ -914,7 +870,6 @@ NETWORK_VMWARE_FILES="src/vnm_mad/remotes/vmware/clean \ # - QCOW2 TM, $VAR_LOCATION/tm/qcow2 # - SSH TM, $VAR_LOCATION/tm/ssh # - DUMMY TM, $VAR_LOCATION/tm/dummy -# - VMWARE TM, $VAR_LOCATION/tm/vmware # - LVM TM, $VAR_LOCATION/tm/lvm # - CEPH TM, $VAR_LOCATION/tm/ceph # - DEV TM, $VAR_LOCATION/tm/dev @@ -1007,23 +962,6 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \ src/tm_mad/dummy/snap_revert \ src/tm_mad/dummy/cpds" -TM_VMFS_FILES="src/tm_mad/vmfs/clone \ - src/tm_mad/vmfs/delete - src/tm_mad/vmfs/ln \ - src/tm_mad/vmfs/mkswap \ - src/tm_mad/vmfs/mkimage \ - src/tm_mad/vmfs/mv \ - src/tm_mad/vmfs/context \ - src/tm_mad/vmfs/mvds \ - src/tm_mad/vmfs/cpds \ - src/tm_mad/vmfs/postmigrate \ - src/tm_mad/vmfs/snap_create \ - src/tm_mad/vmfs/snap_create_live \ - src/tm_mad/vmfs/snap_delete \ - src/tm_mad/vmfs/snap_revert \ - src/tm_mad/vmfs/failmigrate \ - src/tm_mad/vmfs/premigrate" - TM_LVM_FILES="src/tm_mad/lvm/clone \ src/tm_mad/lvm/ln \ src/tm_mad/lvm/mv \ @@ -1102,7 +1040,6 @@ TM_ISCSI_FILES="src/tm_mad/iscsi/clone \ # Datastore drivers, to be installed under $REMOTES_LOCATION/datastore # - Dummy Image Repository, $REMOTES_LOCATION/datastore/dummy # - FS based Image Repository, $REMOTES_LOCATION/datastore/fs -# - VMFS based Image Repository, $REMOTES_LOCATION/datastore/vmfs # - LVM based Image Repository, $REMOTES_LOCATION/datastore/lvm #------------------------------------------------------------------------------- @@ -1135,17 +1072,6 @@ DATASTORE_DRIVER_FS_SCRIPTS="src/datastore_mad/remotes/fs/cp \ src/datastore_mad/remotes/fs/rm \ src/datastore_mad/remotes/fs/export" -DATASTORE_DRIVER_VMFS_SCRIPTS="src/datastore_mad/remotes/vmfs/cp \ - src/datastore_mad/remotes/vmfs/mkfs \ - src/datastore_mad/remotes/vmfs/stat \ - src/datastore_mad/remotes/vmfs/clone \ - src/datastore_mad/remotes/vmfs/monitor \ - src/datastore_mad/remotes/vmfs/rm \ - src/datastore_mad/remotes/vmfs/snap_delete \ - src/datastore_mad/remotes/vmfs/snap_revert \ - src/datastore_mad/remotes/vmfs/snap_flatten \ - src/datastore_mad/remotes/vmfs/vmfs.conf" - DATASTORE_DRIVER_LVM_SCRIPTS="src/datastore_mad/remotes/lvm/cp \ src/datastore_mad/remotes/lvm/mkfs \ src/datastore_mad/remotes/lvm/stat \ @@ -1287,8 +1213,6 @@ ETC_FILES="share/etc/oned.conf \ share/etc/defaultrc \ src/scheduler/etc/sched.conf" -VMWARE_ETC_FILES="src/vmm_mad/remotes/vmware/vmwarerc" - EC2_ETC_FILES="src/vmm_mad/remotes/ec2/ec2_driver.conf \ src/vmm_mad/remotes/ec2/ec2_driver.default" @@ -1307,7 +1231,6 @@ AZ_ETC_FILES="src/vmm_mad/remotes/az/az_driver.conf \ VMM_EXEC_ETC_FILES="src/vmm_mad/exec/vmm_execrc \ src/vmm_mad/exec/vmm_exec_kvm.conf \ - src/vmm_mad/exec/vmm_exec_vmware.conf \ src/vmm_mad/exec/vmm_exec_vcenter.conf" #------------------------------------------------------------------------------- diff --git a/share/doc/xsd/oned.conf b/share/doc/xsd/oned.conf index 5f239146f3..4d056f2e0e 100644 --- a/share/doc/xsd/oned.conf +++ b/share/doc/xsd/oned.conf @@ -374,7 +374,7 @@ VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ] TM_MAD = [ executable = "one_tm", - arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph" + arguments = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,ceph" ] #******************************************************************************* @@ -392,7 +392,7 @@ TM_MAD = [ DATASTORE_MAD = [ executable = "one_datastore", - arguments = "-t 15 -d dummy,fs,vmfs,lvm,ceph" + arguments = "-t 15 -d dummy,fs,lvm,ceph" ] #******************************************************************************* @@ -681,10 +681,6 @@ TM_MAD_CONF = [ name = "ssh", ln_target = "SYSTEM", clone_target = "SYSTEM", shared = "no" ] -TM_MAD_CONF = [ - name = "vmfs", ln_target = "NONE", clone_target= "SYSTEM", shared = "yes" -] - TM_MAD_CONF = [ name = "ceph", ln_target = "NONE", clone_target = "SELF", shared = "yes" ] diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 99c3bd9b52..ba37eb59cf 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -39,7 +39,7 @@ # passwd : (mysql) the password for user # db_name : (mysql) the database name # -# VNC_PORTS: VNC port pool fot automatic VNC port assigment, if possible the +# VNC_PORTS: VNC port pool fot automatic VNC port assigment, if possible the # port will be set to ``START`` + ``VMID`` # start : first port to assgin # reserved: comma separated list of ports @@ -196,7 +196,7 @@ DEFAULT_COST = [ # reserved: Comma separated list of VLAN_IDs # # VXLAN_IDS: Automatic VXLAN Network ID (VNI) assigment. This is used -# for vxlan networks. +# for vxlan networks. # start: First VNI to use # NOTE: reserved is not supported by this pool #******************************************************************************* @@ -312,18 +312,6 @@ IM_MAD = [ # ARGUMENTS = "-r 3 -t 15 kvm-probes" ] #------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# VMware Information Driver Manager Configuration -# -r number of retries when monitoring a host -# -t number of threads, i.e. number of hosts monitored at the same time -#------------------------------------------------------------------------------- -#IM_MAD = [ -# NAME = "vmware", -# EXECUTABLE = "one_im_sh", -# ARGUMENTS = "-c -t 15 -r 0 vmware" ] -#------------------------------------------------------------------------------- - #------------------------------------------------------------------------------- # vCenter Information Driver Manager Configuration # -r number of retries when monitoring a host @@ -450,27 +438,6 @@ VM_MAD = [ #------------------------------------------------------------------------------- -#------------------------------------------------------------------------------- -# VMware Virtualization Driver Manager Configuration -# -r number of retries when monitoring a host -# -t number of threads, i.e. number of hosts monitored at the same time -# -p more than one action per host in parallel, needs support from hypervisor -# -s to execute commands, bash by default -# -d default snapshot strategy. It can be either 'detach' or 'suspend'. It -# defaults to 'suspend'. -#------------------------------------------------------------------------------- -#VM_MAD = [ -# NAME = "vmware", -# EXECUTABLE = "one_vmm_sh", -# ARGUMENTS = "-t 15 -r 0 vmware -s sh", -# DEFAULT = "vmm_exec/vmm_exec_vmware.conf", -# TYPE = "vmware", -# IMPORTED_VMS_ACTIONS = "shutdown, shutdown-hard, hold, release, suspend, -# resume, delete, reboot, reboot-hard, resched, unresched, disk-attach, -# disk-detach, nic-attach, nic-detach, snap-create, snap-delete" -# ] -#------------------------------------------------------------------------------- - #------------------------------------------------------------------------------- # vCenter Virtualization Driver Manager Configuration # -r number of retries when monitoring a host @@ -568,7 +535,7 @@ VM_MAD = [ TM_MAD = [ EXECUTABLE = "one_tm", - ARGUMENTS = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,vmfs,ceph,dev,vcenter,iscsi" + ARGUMENTS = "-t 15 -d dummy,lvm,shared,fs_lvm,qcow2,ssh,ceph,dev,vcenter,iscsi" ] #******************************************************************************* @@ -587,7 +554,7 @@ TM_MAD = [ DATASTORE_MAD = [ EXECUTABLE = "one_datastore", - ARGUMENTS = "-t 15 -d dummy,fs,vmfs,lvm,ceph,dev,iscsi,vcenter -s shared,ssh,ceph" + ARGUMENTS = "-t 15 -d dummy,fs,lvm,ceph,dev,iscsi,vcenter -s shared,ssh,ceph" ] #******************************************************************************* @@ -944,10 +911,6 @@ TM_MAD_CONF = [ DS_MIGRATE = "YES" ] -TM_MAD_CONF = [ - NAME = "vmfs", LN_TARGET = "NONE", CLONE_TARGET= "SYSTEM", SHARED = "YES" -] - TM_MAD_CONF = [ NAME = "ceph", LN_TARGET = "NONE", CLONE_TARGET = "SELF", SHARED = "YES", DS_MIGRATE = "NO" @@ -1018,10 +981,6 @@ DS_MAD_CONF = [ NAME = "ssh", REQUIRED_ATTRS = "", PERSISTENT_ONLY = "NO" ] -DS_MAD_CONF = [ - NAME = "vmfs", REQUIRED_ATTRS = "BRIDGE_LIST", PERSISTENT_ONLY = "NO" -] - DS_MAD_CONF = [ NAME = "vcenter", REQUIRED_ATTRS = "VCENTER_CLUSTER", PERSISTENT_ONLY = "YES", MARKETPLACE_ACTIONS = "export" diff --git a/src/datastore_mad/remotes/common/stat b/src/datastore_mad/remotes/common/stat index 8b0b1a09e8..54722d1465 100755 --- a/src/datastore_mad/remotes/common/stat +++ b/src/datastore_mad/remotes/common/stat @@ -20,8 +20,7 @@ # Set up Environment and transfer arguments # ------------------------------------------------------------------------------ # -# vmfs.conf: includes default TMP_DIR -# libfs.sh a& scripts_common.sh: includes tools and lib calls +# libfs.sh & scripts_common.sh: includes tools and lib calls # ------------------------------------------------------------------------------ if [ -z "${ONE_LOCATION}" ]; then diff --git a/src/datastore_mad/remotes/vmfs/clone b/src/datastore_mad/remotes/vmfs/clone deleted file mode 100755 index 159712f1be..0000000000 --- a/src/datastore_mad/remotes/vmfs/clone +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -############################################################################### -# This script is used to copy a VM image (SRC) to the image repository as DST -# Several SRC types are supported -############################################################################### - -# ------------------------------------------------------------------------------ -# Set up Environment and transfer arguments -# ------------------------------------------------------------------------------ -# -# vmfs.conf: includes default TMP_DIR -# libfs.sh a& scripts_common.sh: includes tools and lib calls -# ------------------------------------------------------------------------------ - -if [ -z "${ONE_LOCATION}" ]; then - LIB_LOCATION=/usr/lib/one - VMWARERC=/etc/one/vmwarerc -else - LIB_LOCATION=$ONE_LOCATION/lib - VMWARERC=$ONE_LOCATION/etc/vmwarerc -fi - -. $LIB_LOCATION/sh/scripts_common.sh - -DRIVER_PATH=$(dirname $0) -source ${DRIVER_PATH}/../libfs.sh -source ${DRIVER_PATH}/vmfs.conf - -# -------- Get clone and datastore arguments from OpenNebula core ------------ - -DRV_ACTION=$1 -ID=$2 - -XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" - -unset i j XPATH_ELEMENTS - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \ - /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ - /DS_DRIVER_ACTION_DATA/IMAGE/PATH \ - /DS_DRIVER_ACTION_DATA/IMAGE/TYPE \ - /DS_DRIVER_ACTION_DATA/IMAGE/CLONE_FSTYPE) - -BASE_PATH="${XPATH_ELEMENTS[j++]}" -BRIDGE_LIST="${XPATH_ELEMENTS[j++]}" -DS_ID="${XPATH_ELEMENTS[j++]}" -SRC="${XPATH_ELEMENTS[j++]}" -IMAGE_TYPE="${XPATH_ELEMENTS[j++]}" -CLONE_FSTYPE="${XPATH_ELEMENTS[j++]}" - - -# ------------------------------------------------------------------------------ -# Set up datastore -# ------------------------------------------------------------------------------ -# -# DST is the final generated image SOURCE, e.g. /vmfs/volumes/104/834efd1/ -# SRC/DST_FOLDER is the image folder name, e.g. 834efd1 -# DST_HOST is the host to make the transfers (from BRIDGE_LIST) -# ------------------------------------------------------------------------------ - -DST=`generate_image_path` - -SRC_FOLDER=`basename $SRC` -DST_FOLDER=`basename $DST` - -DST_HOST=`get_destination_host $ID` - -if [ -z "$DST_HOST" ]; then - error_message "Datastore template missing 'BRIDGE_LIST' attribute." - exit -1 -fi - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" - - -# ------------------------------------------------------------------------------ -# Copy the image to the repository -# ------------------------------------------------------------------------------ - -log "Copying local image $SRC to the image repository" - -if ! is_cdrom; then - exec_and_log "ssh_make_path $DST_HOST $DST" \ - "Cannot create $DST in $DST_HOST" - - if [ ! -z $CLONE_FSTYPE ]; then - CLONE_FSTYPE="-d $CLONE_FSTYPE" - fi - - ssh_exec_and_log $DST_HOST "$VMKFSTOOLS $CLONE_FSTYPE -i $SRC/disk.vmdk $DST/disk.vmdk" \ - "Error copying $SRC/disk.vmdk to $DST/disk.vmdk" -else - ssh_exec_and_log $DST_HOST "cp $SRC $DST" \ - "Error copying $SRC $DST in $DST_HOST" -fi - -# ------------------------------------------------------------------------------ -# Send SOURCE to OpenNebula core -# ------------------------------------------------------------------------------ - -echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/cp b/src/datastore_mad/remotes/vmfs/cp deleted file mode 100755 index 1aed20504f..0000000000 --- a/src/datastore_mad/remotes/vmfs/cp +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -# ------------------------------------------------------------------------------ -# Set up Environment and transfer arguments -# ------------------------------------------------------------------------------ -# -# vmfs.conf: includes default TMP_DIR -# libfs.sh a& scripts_common.sh: includes tools and lib calls -# ------------------------------------------------------------------------------ - -if [ -z "${ONE_LOCATION}" ]; then - LIB_LOCATION=/usr/lib/one - VMWARERC=/etc/one/vmwarerc -else - LIB_LOCATION=$ONE_LOCATION/lib - VMWARERC=$ONE_LOCATION/etc/vmwarerc -fi - -. $LIB_LOCATION/sh/scripts_common.sh - -DRIVER_PATH=$(dirname $0) -source ${DRIVER_PATH}/../libfs.sh -source ${DRIVER_PATH}/vmfs.conf - -# -------- cp and datastore arguments from OpenNebula core ------------ - -DRV_ACTION=$1 -ID=$2 - -export DRV_ACTION - -UTILS_PATH="${DRIVER_PATH}/.." - -XPATH="$UTILS_PATH/xpath.rb -b $DRV_ACTION" - -unset i j XPATH_ELEMENTS - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \ - /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/DS_TMP_DIR \ - /DS_DRIVER_ACTION_DATA/IMAGE/PATH \ - /DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5 \ - /DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1 \ - /DS_DRIVER_ACTION_DATA/IMAGE/TYPE \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/LIMIT_TRANSFER_BW) - -BASE_PATH="${XPATH_ELEMENTS[j++]}" -DS_ID="${XPATH_ELEMENTS[j++]}" -RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}" -SAFE_DIRS="${XPATH_ELEMENTS[j++]}" -BRIDGE_LIST="${XPATH_ELEMENTS[j++]}" -TMP_DIR="${XPATH_ELEMENTS[j++]:-$DS_TMP_DIR}" -SRC="${XPATH_ELEMENTS[j++]}" -MD5="${XPATH_ELEMENTS[j++]}" -SHA1="${XPATH_ELEMENTS[j++]}" -IMAGE_TYPE="${XPATH_ELEMENTS[j++]}" -NO_DECOMPRESS="${XPATH_ELEMENTS[j++]}" -LIMIT_TRANSFER_BW="${XPATH_ELEMENTS[j++]}" - -# ------------------------------------------------------------------------------ -# Set up datastore & transfer folder -# ------------------------------------------------------------------------------ -# -# DST is the final generated image SOURCE, e.g. /vmfs/volumes/104/834efd1/ -# DST_FOLDER is the image folder name, e.g. 834efd1 -# DST_HOST is the host to make the transfers (from BRIDGE_LIST) -# TMP_FOLDER tmp folder to download images, e.g. /var/tmp/834efd1/ -# ------------------------------------------------------------------------------ - -DST=`generate_image_path` - -DST_FOLDER=`basename $DST` -DST_HOST=`get_destination_host $ID` - -if [ -z "$DST_HOST" ]; then - error_message "Datastore template missing 'BRIDGE_LIST' attribute." - exit -1 -fi - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" - -TMP_FOLDER="$TMP_DIR/$DST_FOLDER" - -if [ ! -d $TMP_DIR ]; then - mkdir -p $TMP_DIR -fi - -# ------------------------------------------------------------------------------ -# Download Image to front-end -# ------------------------------------------------------------------------------ - -DOWNLOADER_ARGS=`set_downloader_args "$MD5" "$SHA1" "$NO_DECOMPRESS" "$LIMIT_TRANSFER_BW" "$SRC" "$TMP_FOLDER"` - -COPY_COMMAND="$UTILS_PATH/downloader.sh $DOWNLOADER_ARGS" - -case $SRC in -http://*|https://* ) - log "Downloading $SRC to the image repository" - - exec_and_log "$COPY_COMMAND" "Error copying $SRC to $TMP_FOLDER" - SRC="$TMP_FOLDER" - ;; - -*) - if [ `check_restricted $SRC` -eq 1 ]; then - log_error "Not allowed to copy images from $RESTRICTED_DIRS" - error_message "Not allowed to copy image file $SRC" - exit -1 - fi - - if is_cdrom; then - log "Copying local CD-ROM $SRC to the image repository" - elif [ -d $SRC ]; then - log "Copying local disk folder $SRC to the image repository" - else - exec_and_log "$COPY_COMMAND" "Error copying $SRC to $TMP_FOLDER" - SRC="$TMP_FOLDER" - fi - ;; -esac - -# ------------------------------------------------------------------------------ -# Make the final hop, front-end -> VMFS Datastore -# ------------------------------------------------------------------------------ - -if [ -d "$SRC" -a ! -f "$SRC/disk.vmdk" ]; then - BASE_DISK_FILE=`ls $SRC | grep '\.vmdk$' | grep -v '\-\(flat\|delta\|s[0-9]*\)\.vmdk$'` - - exec_and_log "mv -f $SRC/$BASE_DISK_FILE $SRC/disk.vmdk" \ - "Error renaming file $SRC/$BASE_DISK_FILE to $SRC/disk.vmdk" -fi - -if ! is_cdrom; then - exec_and_log "ssh_make_path $DST_HOST $DST" \ - "Cannot create $DST in $DST_HOST" - - exec_and_log "$SCP -r $SRC/* $DST_HOST:$DST" \ - "Error copying $SRC to $DST through SCP" -else - exec_and_log "$SCP $SRC $DST_HOST:$DST" \ - "Error copying $SRC to $DST through SCP" -fi - -if [ -d "$TMP_FOLDER" -a -n "$DST_FOLDER" ]; then - rm -rf "$TMP_FOLDER" > /dev/null 2>&1 -fi - -# ------------------------------------------------------------------------------ -# Send SOURCE to OpenNebula core -# ------------------------------------------------------------------------------ - -echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/mkfs b/src/datastore_mad/remotes/vmfs/mkfs deleted file mode 100755 index 0e59b207b6..0000000000 --- a/src/datastore_mad/remotes/vmfs/mkfs +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -# ------------------------------------------------------------------------------ -# Set up Environment and transfer arguments -# ------------------------------------------------------------------------------ -# -# vmfs.conf: includes default TMP_DIR -# libfs.sh a& scripts_common.sh: includes tools and lib calls -# ------------------------------------------------------------------------------ - -if [ -z "${ONE_LOCATION}" ]; then - LIB_LOCATION=/usr/lib/one - VMWARERC=/etc/one/vmwarerc -else - LIB_LOCATION=$ONE_LOCATION/lib - VMWARERC=$ONE_LOCATION/etc/vmwarerc -fi - -. $LIB_LOCATION/sh/scripts_common.sh - -DRIVER_PATH=$(dirname $0) -source ${DRIVER_PATH}/../libfs.sh -source ${DRIVER_PATH}/vmfs.conf - -# -------- Get mkfs and datastore arguments from OpenNebula core ------------ - -DRV_ACTION=$1 -ID=$2 - -XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" - -unset i j XPATH_ELEMENTS - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/RESTRICTED_DIRS \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST \ - /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ - /DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ - /DS_DRIVER_ACTION_DATA/IMAGE/SIZE) - -BASE_PATH="${XPATH_ELEMENTS[j++]}" -RESTRICTED_DIRS="${XPATH_ELEMENTS[j++]}" -SAFE_DIRS="${XPATH_ELEMENTS[j++]}" -BRIDGE_LIST="${XPATH_ELEMENTS[j++]}" -DS_ID="${XPATH_ELEMENTS[j++]}" -FSTYPE="${XPATH_ELEMENTS[j++]}" -SIZE="${XPATH_ELEMENTS[j++]}" - -# ------------------------------------------------------------------------------ -# Set up datastore -# ------------------------------------------------------------------------------ -# -# DST is the final generated image SOURCE, e.g. /vmfs/volumes/104/834efd1/ -# DST_FOLDER is the image folder name, e.g. 834efd1 -# DST_HOST is the host to make the transfers (from BRIDGE_LIST) -# ------------------------------------------------------------------------------ - -DST=`generate_image_path` -DST_FOLDER=`basename $DST` -DST_HOST=`get_destination_host $ID` - -if [ -z "$DST_HOST" ]; then - error_message "Datastore template missing 'BRIDGE_LIST' attribute." - exit -1 -fi - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" - -# ------------------------------------------------------------------------------ -# Create image folder and set image size and attributes -# ------------------------------------------------------------------------------ - -exec_and_log "ssh_make_path $DST_HOST $DST" "Cannot create $DST in $DST_HOST" - -IMAGE_FORMAT=vmdk -VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` - -echo "$VMWARE_DISK_TYPE" | \ - grep '\\|\\|\' 2>&1 /dev/null - -if [ $? -eq 1 ] ; then - VMWARE_DISK_TYPE="thin" -fi - -# ------------------------------------------------------------------------------ -# Create the image within the datastore -# ------------------------------------------------------------------------------ - -if [ "$FSTYPE" = "save_as" ]; then - echo "$DST" - exit 0 -fi - -log "Making raw filesystem of ${SIZE}M at $DST on $DST_HOST" - -ssh_exec_and_log $DST_HOST \ - "$VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" \ - "Cannot create $DST/disk.vmdk on $DST_HOST" - -# ------------------------------------------------------------------------------ -# Send SOURCE to OpenNebula core -# ------------------------------------------------------------------------------ - -echo "$DST" diff --git a/src/datastore_mad/remotes/vmfs/monitor b/src/datastore_mad/remotes/vmfs/monitor deleted file mode 100755 index 4a87d65bdc..0000000000 --- a/src/datastore_mad/remotes/vmfs/monitor +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -############################################################################### -# This script is used to monitor the free and used space of a datastore -############################################################################### - -# -------- Set up the environment to source common tools & conf ------------ - -if [ -z "${ONE_LOCATION}" ]; then - LIB_LOCATION=/usr/lib/one -else - LIB_LOCATION=$ONE_LOCATION/lib -fi - -. $LIB_LOCATION/sh/scripts_common.sh - -DRIVER_PATH=$(dirname $0) -source ${DRIVER_PATH}/../libfs.sh - -# -------- Get datastore arguments from OpenNebula core ------------ - -DRV_ACTION=$1 -ID=$2 - -XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" - -unset i XPATH_ELEMENTS - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <($XPATH /DS_DRIVER_ACTION_DATA/DATASTORE/BASE_PATH \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST) - -BASE_PATH="${XPATH_ELEMENTS[0]}" -BRIDGE_LIST="${XPATH_ELEMENTS[1]}" - -HOST=`get_destination_host` - -if [ -z "$HOST" ]; then - error_message "Datastore template missing 'BRIDGE_LIST' attribute." - exit -1 -fi - -# ------------ Compute datastore usage ------------- - -MONITOR_SCRIPT=$(cat </dev/null | $CUT -f1) - -DF_STR=\$($DF -m | grep ${BASE_PATH%/} | sed -e 's/ \+/:/g') - -TOTAL_MB=\$(echo \$DF_STR | $CUT -d: -f 2) -FREE_MB=\$(echo \$DF_STR | $CUT -d: -f 4) - -echo "USED_MB=\$USED_MB" -echo "TOTAL_MB=\$TOTAL_MB" -echo "FREE_MB=\$FREE_MB" -EOF -) - -MONITOR_DATA=$(ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" 2>&1) -MONITOR_STATUS=$? - -if [ "$MONITOR_STATUS" = "0" ]; then - echo "$MONITOR_DATA" | tr ' ' '\n' -else - echo "$MONITOR_DATA" - exit $MONITOR_STATUS -fi diff --git a/src/datastore_mad/remotes/vmfs/rm b/src/datastore_mad/remotes/vmfs/rm deleted file mode 100755 index f30d8da9be..0000000000 --- a/src/datastore_mad/remotes/vmfs/rm +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # -# ------------------------------------------------------------------------------ -# Set up Environment and transfer arguments -# ------------------------------------------------------------------------------ -# -# vmfs.conf: includes default TMP_DIR -# libfs.sh a& scripts_common.sh: includes tools and lib calls -# ------------------------------------------------------------------------------ - -if [ -z "${ONE_LOCATION}" ]; then - LIB_LOCATION=/usr/lib/one - VMWARERC=/etc/one/vmwarerc -else - LIB_LOCATION=$ONE_LOCATION/lib - VMWARERC=$ONE_LOCATION/etc/vmwarerc -fi - -. $LIB_LOCATION/sh/scripts_common.sh - -DRIVER_PATH=$(dirname $0) -source ${DRIVER_PATH}/../libfs.sh -source ${DRIVER_PATH}/vmfs.conf - -# -------- Get rm and datastore arguments from OpenNebula core ------------ - -DRV_ACTION=$1 -ID=$2 - -XPATH="${DRIVER_PATH}/../xpath.rb -b $DRV_ACTION" - -unset i j XPATH_ELEMENTS - -while IFS= read -r -d '' element; do - XPATH_ELEMENTS[i++]="$element" -done < <($XPATH /DS_DRIVER_ACTION_DATA/IMAGE/SOURCE \ - /DS_DRIVER_ACTION_DATA/DATASTORE/ID \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BRIDGE_LIST) - -SRC="${XPATH_ELEMENTS[j++]}" -DS_ID="${XPATH_ELEMENTS[j++]}" -BRIDGE_LIST="${XPATH_ELEMENTS[j++]}" - -# ------------------------------------------------------------------------------ -# Set up datastore -# ------------------------------------------------------------------------------ -# -# SRC is the image SOURCE to remove, e.g. /vmfs/volumes/104/834efd1/ -# SRC_FOLDER is the image folder name, e.g. 834efd1 -# DST_HOST is the host to make the transfers (from BRIDGE_LIST) -# ------------------------------------------------------------------------------ - -DST_HOST=`get_destination_host $ID` - -if [ -z "$DST_HOST" ]; then - error_message "Datastore template missing 'BRIDGE_LIST' attribute." - exit -1 -fi - -SRC_FOLDER=`basename $SRC` - -# ------------------------------------------------------------------------------ -# Remove the image from the repository -# ------------------------------------------------------------------------------ - -if [ -n $SRC -a -n $DST_HOST ]; then - log "Removing $SRC from the image repository" - - ssh_exec_and_log $DST_HOST "rm -rf $SRC" "Error deleting $SRC on $DST_HOST" -fi - -exit 0 diff --git a/src/datastore_mad/remotes/vmfs/snap_delete b/src/datastore_mad/remotes/vmfs/snap_delete deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/vmfs/snap_delete +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/vmfs/snap_flatten b/src/datastore_mad/remotes/vmfs/snap_flatten deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/vmfs/snap_flatten +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/vmfs/snap_revert b/src/datastore_mad/remotes/vmfs/snap_revert deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/vmfs/snap_revert +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/vmfs/stat b/src/datastore_mad/remotes/vmfs/stat deleted file mode 120000 index 65583e827b..0000000000 --- a/src/datastore_mad/remotes/vmfs/stat +++ /dev/null @@ -1 +0,0 @@ -../common/stat \ No newline at end of file diff --git a/src/datastore_mad/remotes/vmfs/vmfs.conf b/src/datastore_mad/remotes/vmfs/vmfs.conf deleted file mode 100644 index 663b71c6f8..0000000000 --- a/src/datastore_mad/remotes/vmfs/vmfs.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -# Default values in case they are not defined in the Datastore template - -DS_TMP_DIR=/var/lib/one/tmp - - diff --git a/src/im_mad/remotes/vmware.d/vmware.rb b/src/im_mad/remotes/vmware.d/vmware.rb deleted file mode 100755 index 6f6b38483d..0000000000 --- a/src/im_mad/remotes/vmware.d/vmware.rb +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 - -$: << "../../vmm/vmware/" - -require 'vi_driver' - -host = ARGV[-1] - -if !host - exit -1 -end - -VIDriver::initialize(host) - -results = VIDriver::poll_host_and_vms - -if results != -1 - puts results -else - exit results.to_i -end diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index 1ac9b6dfd4..7a00334d34 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -340,21 +340,6 @@ function mkfs_command { echo "$QEMU_IMG create -f qcow2 $DST ${SIZE}M" return 0 ;; - "vmdk_"*) - VMWARE_DISK_TYPE=`echo $FSTYPE|cut -d'_' -f 2` - - echo "$VMWARE_DISK_TYPE" | \ - grep '\\|\\|\' 2>&1 /dev/null - - if [ $? -eq 1 ] ; then - VMWARE_DISK_TYPE="thin" - fi - - echo "$VMKFSTOOLS -U $DST/disk.vmdk; \ - rm -f $DST/*; \ - $VMKFSTOOLS -c ${SIZE}M -d ${VMWARE_DISK_TYPE} $DST/disk.vmdk" - return 0 - ;; *) echo "" echo "Filesystem '$FSTYPE' not valid." 1>&2 diff --git a/src/tm_mad/common/context b/src/tm_mad/common/context index be27cccc9a..9973cab0ea 100755 --- a/src/tm_mad/common/context +++ b/src/tm_mad/common/context @@ -100,10 +100,6 @@ exec_and_set_error "$MKISOFS -o $ISO_FILE -V CONTEXT -J -R $ISO_DIR" \ exec_and_set_error "$SCP $ISO_FILE $DST" "Error copying context ISO to $DST" [ -n "$ERROR" ] && exit_error -# Creates symbolic link to add a .iso suffix, needed for VMware CDROMs -DST_FILE=${DST_PATH##*/} -ssh_exec_and_log $DST_HOST "cd $DST_DIR && $LN -sf $DST_FILE $DST_FILE.iso" "Error creating ISO symbolic link" - rm -rf $ISO_DIR > /dev/null 2>&1 exit 0 diff --git a/src/tm_mad/vmfs/clone b/src/tm_mad/vmfs/clone deleted file mode 100755 index a9281a0965..0000000000 --- a/src/tm_mad/vmfs/clone +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -# clone fe:SOURCE host:remote_system_ds/disk.i vmid dsid -# - fe is the front-end hostname -# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk -# - host is the target host to deploy the VM -# - remote_system_ds is the path for the system datastore in the host -# - vmid is the id of the VM -# - dsid is the target datastore (0 is the system datastore) - -SRC=$1 -DST=$2 - -VMID=$3 -DSID=$4 - -if [ -z "${ONE_LOCATION}" ]; then - TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh - VMWARERC=/etc/one/vmwarerc -else - TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh - VMWARERC=$ONE_LOCATION/etc/vmwarerc -fi - -. $TMCOMMON - -#------------------------------------------------------------------------------- -# Retrieve needed information, Example (same for SRC) -# DST : esx1:/vmfs/volumes/105/90/disk.0 -# SRC : one:/vmfs/volumes/104/84045f4a -# DST_PATH : /vmfs/volumes/105/90/disk.0 -# DST_DIR : /vmfs/volumes/105/90/ -# DST_HOST : esx1 -# -# DISK_TYPE: CDROM if it is a cd (not a directory) -#------------------------------------------------------------------------------- - -SRC_PATH=`arg_path $SRC` -DST_PATH=`arg_path $DST` - -DST_HOST=`arg_host $DST` -DST_DIR=`dirname $DST_PATH` - -DISK_TYPE=$(disk_type) - -#------------------------------------------------------------------------------- -# Clone (cp) SRC into DST -#------------------------------------------------------------------------------- - -log "Cloning $SRC in $DST" - -CLONESCRIPT=$(cat < vmid dsid -# - host is the target host to deploy the VM -# - remote_system_ds is the path for the system datastore in the host -# - vmid is the id of the VM -# - dsid is the target datastore - -DST=$1 -VMID=$2 - -if [ -z "${ONE_LOCATION}" ]; then - TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh - VMWARERC=/etc/one/vmwarerc -else - TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh - VMWARERC=$ONE_LOCATION/etc/vmwarerc -fi - -. $TMCOMMON - -#------------------------------------------------------------------------------- -# Retrieve needed information -# DST : esx1:/vmfs/volumes/105/90/disk.0 -# DST_PATH : /vmfs/volumes/105/90/disk.0 -# DST_HOST : esx1 -# DSID : 105 -#------------------------------------------------------------------------------- - -DST_PATH=`arg_path $DST` -DST_HOST=`arg_host $DST` - -#------------------------------------------------------------------------------- -# Return if deleting a disk, we will delete them when removing the -# remote_system_ds directory for the VM (remotely) -#------------------------------------------------------------------------------- - -if [ `is_disk $DST_PATH` -eq 1 ]; then - exit 0 -else - ssh_exec_and_log $DST_HOST "rm -rf $DST_PATH" "Error deleting $DST_PATH" -fi - -exit 0 diff --git a/src/tm_mad/vmfs/failmigrate b/src/tm_mad/vmfs/failmigrate deleted file mode 120000 index 5928a42794..0000000000 --- a/src/tm_mad/vmfs/failmigrate +++ /dev/null @@ -1 +0,0 @@ -../common/failmigrate \ No newline at end of file diff --git a/src/tm_mad/vmfs/ln b/src/tm_mad/vmfs/ln deleted file mode 100755 index 570daf9fd7..0000000000 --- a/src/tm_mad/vmfs/ln +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -# ln fe:SOURCE host:remote_system_ds/disk.i vmid dsid -# - fe is the front-end hostname -# - SOURCE is the path of the disk image in the form DS_BASE_PATH/disk -# - host is the target host to deploy the VM -# - remote_system_ds is the path for the system datastore in the host -# - vmid is the id of the VM -# - dsid is the target datastore (0 is the system datastore) - -SRC=$1 -DST=$2 - -VMID=$3 -DSID=$4 - -if [ -z "${ONE_LOCATION}" ]; then - TMCOMMON=/var/lib/one/remotes/tm/tm_common.sh -else - TMCOMMON=$ONE_LOCATION/var/remotes/tm/tm_common.sh -fi - -. $TMCOMMON - - #-v ------------------------------------------------------------------------------ -# Retrieve needed information, Example (same for SRC) -# DST : esx1:/vmfs/volumes/105/90/disk.0 -# SRC : one:/vmfs/volumes/104/84045f4a -# DST_PATH : /vmfs/volumes/105/90/disk.0 -# DST_DIR : /vmfs/volumes/105/90/ -# DST_HOST : esx1 -# -# DISK_TYPE: CDROM if it is a cd (not a directory) -#------------------------------------------------------------------------------- - -SRC_PATH=`arg_path $SRC` -DST_PATH=`arg_path $DST` - -DST_HOST=`arg_host $DST` -DST_DIR=`dirname $DST_PATH` - -DISK_TYPE=$(disk_type) - -#------------------------------------------------------------------------------- -# Link (ln) SRC into DST -#------------------------------------------------------------------------------- - -if [ "$DISK_TYPE" != "CDROM" ]; then - log "Link all files in $SRC_PATH to $DST_PATH" - - LINK_SCRIPT=$(cat <checkpoint \ No newline at end of file diff --git a/src/vmm_mad/remotes/vmware/deploy b/src/vmm_mad/remotes/vmware/deploy deleted file mode 100755 index d69a1ed392..0000000000 --- a/src/vmm_mad/remotes/vmware/deploy +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -dfile = ARGV[0] -host = ARGV[1] -id = ARGV[2] - -vmware_drv = VMwareDriver.new(host) - -puts vmware_drv.deploy(dfile, id) - -exit 0 diff --git a/src/vmm_mad/remotes/vmware/detach_disk b/src/vmm_mad/remotes/vmware/detach_disk deleted file mode 100755 index f20ae8f751..0000000000 --- a/src/vmm_mad/remotes/vmware/detach_disk +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -source $(dirname $0)/scripts_common_sh.sh - -DEPLOYID="$1" -IMAGE_PATH="$2" -UNIT="$3" -UNIT_NUMBER="$4" - -CONTROLLER_NUMBER=0 # Only one controller at the moment (up to 16 devices) - -# Get the VMware ID corresponding to the deploy_id -VMWAREID=`$SUDO vim-cmd vmsvc/getallvms|grep $DEPLOYID|cut -d' ' -f 1` - -DETACH_PARAMS="$VMWAREID $CONTROLLER_NUMBER $UNIT_NUMBER $IMAGE_PATH" - -exec_and_log "$SUDO vim-cmd vmsvc/device.diskremove $DETACH_PARAMS" \ - "Could not detach $TARGET from $DEPLOYID" \ No newline at end of file diff --git a/src/vmm_mad/remotes/vmware/detach_nic b/src/vmm_mad/remotes/vmware/detach_nic deleted file mode 100755 index 86f5100ceb..0000000000 --- a/src/vmm_mad/remotes/vmware/detach_nic +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env ruby - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vi_driver' - -deploy_id = ARGV[0] -mac = ARGV[1] -host = ARGV[3] - - -VIDriver::initialize(host, false) - -vivm = VIDriver::VIVm.new(deploy_id, nil) - -puts vivm.detach_nic(mac) diff --git a/src/vmm_mad/remotes/vmware/migrate b/src/vmm_mad/remotes/vmware/migrate deleted file mode 100755 index d554a0dc08..0000000000 --- a/src/vmm_mad/remotes/vmware/migrate +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -deploy_id = ARGV[0] -dst_host = ARGV[1] -src_host = ARGV[2] - -vmware_drv = VMwareDriver.new(src_host) - -vmware_drv.migrate(deploy_id, dst_host, src_host) diff --git a/src/vmm_mad/remotes/vmware/poll b/src/vmm_mad/remotes/vmware/poll deleted file mode 100755 index 6060ea1d58..0000000000 --- a/src/vmm_mad/remotes/vmware/poll +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vi_driver' - -deploy_id = ARGV[0] -host = ARGV[1] - -VIDriver::initialize(host) - -puts VIDriver::poll_vm(deploy_id) diff --git a/src/vmm_mad/remotes/vmware/reboot b/src/vmm_mad/remotes/vmware/reboot deleted file mode 100755 index 5795b2d91e..0000000000 --- a/src/vmm_mad/remotes/vmware/reboot +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -deploy_id = ARGV[0] -host = ARGV[1] - -vmware_drv = VMwareDriver.new(host) - -vmware_drv.reboot(deploy_id) diff --git a/src/vmm_mad/remotes/vmware/reset b/src/vmm_mad/remotes/vmware/reset deleted file mode 100755 index 4ce790df49..0000000000 --- a/src/vmm_mad/remotes/vmware/reset +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vi_driver' - -deploy_id = ARGV[0] -host = ARGV[1] - -begin - VIDriver::initialize(host, false) - vivm = VIDriver::VIVm.new(deploy_id, nil) - vivm.reset -rescue Exception => e - STDERR.puts "Reset of VM #{deploy_id} on host #{host} failed " + - "due to \"#{e.message}\"" - exit -1 -end diff --git a/src/vmm_mad/remotes/vmware/restore b/src/vmm_mad/remotes/vmware/restore deleted file mode 100755 index 1ad0214bc7..0000000000 --- a/src/vmm_mad/remotes/vmware/restore +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -checkpoint_file = ARGV[0] -host = ARGV[1] - -vmware_drv = VMwareDriver.new(host) - -vmware_drv.restore(checkpoint_file) diff --git a/src/vmm_mad/remotes/vmware/save b/src/vmm_mad/remotes/vmware/save deleted file mode 100755 index a37ded8d90..0000000000 --- a/src/vmm_mad/remotes/vmware/save +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -deploy_id = ARGV[0] -file = ARGV[1] -host = ARGV[2] - -vmware_drv = VMwareDriver.new(host) - -vmware_drv.save(deploy_id) diff --git a/src/vmm_mad/remotes/vmware/scripts_common_sh.sh b/src/vmm_mad/remotes/vmware/scripts_common_sh.sh deleted file mode 100644 index b912f93bc9..0000000000 --- a/src/vmm_mad/remotes/vmware/scripts_common_sh.sh +++ /dev/null @@ -1,59 +0,0 @@ -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -error_message() -{ - ( - echo "ERROR MESSAGE --8<------" - echo "$1" - echo "ERROR MESSAGE ------>8--" - ) 1>&2 -} - -log_function() -{ - echo "$1: $SCRIPT_NAME: $2" 1>&2 -} - -log_error() -{ - log_function "ERROR" "$1" -} - -exec_and_log() -{ - message=$2 - - EXEC_LOG_ERR=`$1 2>&1 1>/dev/null` - EXEC_LOG_RC=$? - - if [ $EXEC_LOG_RC -ne 0 ]; then - log_error "Command \"$1\" failed: $EXEC_LOG_ERR" - - if [ -n "$2" ]; then - error_message "$2" - else - error_message "Error executing $1: $EXEC_LOG_ERR" - fi - exit $EXEC_LOG_RC - fi -} - -WHICH_SUDO=`which sudo` - -if [ ! -z "$WHICH_SUDO" -a -f "$WHICH_SUDO" ]; then - SUDO="sudo " -fi \ No newline at end of file diff --git a/src/vmm_mad/remotes/vmware/shutdown b/src/vmm_mad/remotes/vmware/shutdown deleted file mode 100755 index 6bc71aafbc..0000000000 --- a/src/vmm_mad/remotes/vmware/shutdown +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' -require 'vi_driver' - -#------------------------------------------------------------------------------ -# Wait the VM to shutdown TIMEOUT (xPOLL_INTERVAL) seconds. -# Set to ~10min -#------------------------------------------------------------------------------ -POLL_INTERVAL=2 -TIMEOUT=300 - -deploy_id = ARGV[0] -host = ARGV[1] - -VIDriver::initialize(host) - -vmware_drv = VMwareDriver.new(host) - -vmware_drv.shutdown(deploy_id) - -count=0 -while (VIDriver::poll_vm(deploy_id).match(/STATE=(.*)/)[1] != "d") do - sleep POLL_INTERVAL - if count > TIMEOUT then - OpenNebula.log_debug("Timeout reached and VM #{deploy_id} is still alive.") - exit -1 - end - count+=POLL_INTERVAL -end diff --git a/src/vmm_mad/remotes/vmware/snapshot_create b/src/vmm_mad/remotes/vmware/snapshot_create deleted file mode 100755 index 1e62fda5d7..0000000000 --- a/src/vmm_mad/remotes/vmware/snapshot_create +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -deploy_id = ARGV[0] -host = ARGV[3] - -vmware_drv = VMwareDriver.new(host) - -hypervisor_id = vmware_drv.snapshot_create(deploy_id) - -puts hypervisor_id -exit 0 diff --git a/src/vmm_mad/remotes/vmware/snapshot_delete b/src/vmm_mad/remotes/vmware/snapshot_delete deleted file mode 100755 index bc735b0b67..0000000000 --- a/src/vmm_mad/remotes/vmware/snapshot_delete +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -deploy_id = ARGV[0] -snapshot_id = ARGV[1] -host = ARGV[3] - -vmware_drv = VMwareDriver.new(host) - -vmware_drv.snapshot_delete(deploy_id, snapshot_id) diff --git a/src/vmm_mad/remotes/vmware/snapshot_revert b/src/vmm_mad/remotes/vmware/snapshot_revert deleted file mode 100755 index 17d0d30572..0000000000 --- a/src/vmm_mad/remotes/vmware/snapshot_revert +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env ruby - -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vmware_driver' - -deploy_id = ARGV[0] -snapshot_id = ARGV[1] -host = ARGV[3] - -vmware_drv = VMwareDriver.new(host) - -vmware_drv.snapshot_revert(deploy_id, snapshot_id) diff --git a/src/vmm_mad/remotes/vmware/vi_driver.rb b/src/vmm_mad/remotes/vmware/vi_driver.rb deleted file mode 100644 index b88e5dff24..0000000000 --- a/src/vmm_mad/remotes/vmware/vi_driver.rb +++ /dev/null @@ -1,513 +0,0 @@ -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -# ---------------------------------------------------------------------------- # - -# -------------------------------------------------------------------------# -# Set up the environment for the driver # -# -------------------------------------------------------------------------# -ONE_LOCATION = ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION) - -if !ONE_LOCATION - BIN_LOCATION = "/usr/bin" if !defined?(BIN_LOCATION) - LIB_LOCATION = "/usr/lib/one" if !defined?(LIB_LOCATION) - ETC_LOCATION = "/etc/one/" if !defined?(ETC_LOCATION) - VAR_LOCATION = "/var/lib/one" if !defined?(VAR_LOCATION) -else - BIN_LOCATION = ONE_LOCATION + "/bin" if !defined?(BIN_LOCATION) - LIB_LOCATION = ONE_LOCATION + "/lib" if !defined?(LIB_LOCATION) - ETC_LOCATION = ONE_LOCATION + "/etc/" if !defined?(ETC_LOCATION) - VAR_LOCATION = ONE_LOCATION + "/var/" if !defined?(VAR_LOCATION) -end - - - -ENV['LANG'] = 'C' - -$: << LIB_LOCATION+'/ruby/vendors/rbvmomi/lib' - -require 'rbvmomi' -require 'yaml' - - -module VIDriver - -CONF_FILE = ETC_LOCATION + "/vmwarerc" -CHECKPOINT = VAR_LOCATION + "/remotes/vmm/vmware/checkpoint" - -############################################################################ -# Initialize the module by creating a VI connection and setting up -# configuration attributes -# @param hostname [String] to access the VI API and interact to -# @param monitor [false, true] monitor the host on creation. Defaults true -############################################################################ -def self.initialize(hostname, monitor = true ) - conf = YAML::load(File.read(CONF_FILE)) - - if conf[:password] and !conf[:password].empty? - pass=conf[:password] - else - pass="\"\"" - end - - begin - @@client = RbVmomi::VIM.connect(:host => hostname, - :user => conf[:username], - :password => pass, - :insecure => true) - @@root = @@client.root - @@host = VIHost.new(hostname) - - @@host.monitor if monitor - - rescue Exception => e - raise "Connection error to #{hostname}: " + e.message - end -end - -############################################################################ -# Return the OpenNebula monitoring string for the given VM -# @param deploy_id [String] OpenNebula VM ID, e.g. "one-237" -############################################################################ -def self.poll_vm(deploy_id) - begin - vm = VIVm.new(deploy_id, nil) - - vm.monitor - str_info = vm.info - - rescue Exception => e - str_info = "STATE=d" - STDERR.puts e.message - end - - return str_info -end - -############################################################################ -# Return the OpenNebula monitoring string for the given host and the running -# VMs in that host -############################################################################ -def self.poll_host_and_vms - begin - str_info = @@host.info - vms_info = @@host.all_vms_info - - str_info << "\nVM_POLL=YES\n" - str_info << "#{vms_info}" if !vms_info.empty? - - rescue Exception => e - STDERR.puts e.message - str_info = "" - end - - return str_info -end - -############################################################################ -# The VIVm is a high level abstraction of a VI VirtualMachine class for -# OpenNebula semantics. The VIDriver::initialize MUST be called before -# instantiating this class -############################################################################ -class VIVm - - ######################################################################## - # Creates a new VIVm using its name or a RbVmomi::VirtualMachine object - # @param vmname [String] the OpenNebula vm deploy_id (e.g. "one-237") - # @param vm_vi [RbVmomi::VirtualMachine] it will be used if not nil - ######################################################################## - def initialize(vmname, vm_vi) - if vm_vi.nil? - @vm = VIDriver::host.vm.find { |v| - v.name == vmname - } - else - @vm = vm_vi - end - - raise "Cannot find VM #{vmname}" if @vm.nil? - end - - ######################################################################## - # Set the guest OS - ######################################################################## - def set_guestos(guest_os_id) - return if (guest_os_id.nil? || guest_os_id.empty? ) - - spec = {:guestId => guest_os_id} - - @vm.ReconfigVM_Task(:spec => spec).wait_for_completion - end - - ######################################################################## - # Set or removes a pciBridge from VM - ######################################################################## - def set_pcibridge(pciBridge) - num = pciBridge.to_i - - return if (num == 0) - - spec = [] - - num.times { |i| - spec << { :key => "pciBridge#{i}.present", :value => "TRUE" } - } - - vmspec = RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig => spec) - - @vm.ReconfigVM_Task(:spec => vmspec).wait_for_completion - end - - ######################################################################## - # - ######################################################################## - def attach_nic(bridge, mac, model='default') - return if bridge.empty? || mac.empty? - - card_num = 1 # start in one, we want the next avaiable id - - @vm.config.hardware.device.each{ |dv| - if dv.class.ancestors[1] == RbVmomi::VIM::VirtualEthernetCard - card_num = card_num + 1 - end - } - - backing = RbVmomi::VIM.VirtualEthernetCardNetworkBackingInfo( - :deviceName => bridge) - - device_spec = { - :key => 0, - :deviceInfo => { - :label => "net" + card_num.to_s, - :summary => bridge - }, - :backing => backing, - :addressType => 'manual', - :macAddress => mac - } - - device = case model.downcase - when 'pcnet32' - RbVmomi::VIM.VirtualPCNet32(device_spec) - when 'VirtualVmxnet' - RbVmomi::VIM.VirtualVmxnet(device_spec) - else # By default, assume E1000 model - RbVmomi::VIM.VirtualE1000(device_spec) - end - - spec = {:deviceChange => [:operation => :add, :device => device]} - - @vm.ReconfigVM_Task(:spec => spec).wait_for_completion - end - - ######################################################################## - # Initialize the vm monitor information - ######################################################################## - def detach_nic(mac) - - eth = @vm.config.hardware.device.find { |d| - (d.class.ancestors[1] == RbVmomi::VIM::VirtualEthernetCard) && - (d.macAddress == mac) - } - - return -1 if eth.nil? - - spec = { - :deviceChange => [ - :operation => :remove, - :device => eth - ] - } - - @vm.ReconfigVM_Task(:spec => spec).wait_for_completion - end - - ############################################################################ - # Resets a VM - # @param deploy_id vcenter identifier of the VM - # @param hostname name of the host (equals the vCenter cluster) - ############################################################################ - def reset - @vm.ResetVM_Task.wait_for_completion - end - - ######################################################################## - # Initialize the vm monitor information - ######################################################################## - def monitor - @summary = @vm.summary - @state = state_to_c(@summary.runtime.powerState) - - if @state != 'a' - @used_cpu = 0 - @used_memory = 0 - - @netrx = 0 - @nettx = 0 - - return - end - - @used_memory = @summary.quickStats.hostMemoryUsage * 1024 - - host = VIDriver::host - cpuMhz = host.cpuMhz.to_f - @used_cpu = - ((@summary.quickStats.overallCpuUsage.to_f / cpuMhz) * 100).to_s - @used_cpu = sprintf('%.2f',@used_cpu).to_s - - vm_stats = VIDriver::retrieve_stats([@vm], - ["net.packetsRx","net.packetsTx"]) - @netrx = 0 - @nettx = 0 - - if vm_stats[@vm] && vm_stats[@vm][:metrics] - if vm_stats[@vm][:metrics]["net.packetsRx"] - @netrx = vm_stats[@vm][:metrics]["net.packetsRx"].first - end - - if vm_stats[@vm][:metrics]["net.packetsTx"] - @nettx = vm_stats[@vm][:metrics]["net.packetsTx"].first - end - end - - # Check for negative values - @used_memory = 0 if @used_memory.to_i < 0 - @used_cpu = 0 if @used_cpu.to_i < 0 - @netrx = 0 if @netrx.to_i < 0 - @nettx = 0 if @nettx.to_i < 0 - end - - ######################################################################## - # Generates a OpenNebula IM Driver valid string with the monitor info - ######################################################################## - def info - return 'STATE=d' if @state == 'd' - - str_info = "" - - str_info << "STATE=" << @state << " " - str_info << "CPU=" << @used_cpu.to_s << " " - str_info << "MEMORY=" << @used_memory.to_s << " " - str_info << "NETRX=" << @netrx.to_s << " " - str_info << "NETTX=" << @nettx.to_s - end - -private - - ######################################################################## - # Converts the VI string state to OpenNebula state convention - # Guest states are: - # - poweredOff The virtual machine is currently powered off. - # - poweredOn The virtual machine is currently powered on. - # - suspended The virtual machine is currently suspended. - ######################################################################## - def state_to_c(state) - case state - when 'poweredOn' - 'a' - when 'suspended' - 'p' - when 'poweredOff' - 'd' - else - '-' - end - end -end - -private - -############################################################################ -# The VIHost is a high level abstraction of a HostSystem class for -# OpenNebula semantics. The VIDriver::initialize MUST be called before -# instantiating this class -############################################################################ -class VIHost - attr_reader :host, :cpuMhz, :numCpuCores - - def initialize(hostname) - @ip = Socket.getaddrinfo(hostname,nil).first[3] - - raise "Cannot get host IP" if @ip.nil? || @ip.empty? - - @host =VIDriver::root.findByIp @ip, RbVmomi::VIM::HostSystem - - raise "Cannot find host #{hostname}" if @host.nil? - end - - ######################################################################## - # Initialize the host monitor information - ######################################################################## - def monitor - summary = @host.summary - hardware = summary.hardware - stats = summary.quickStats - - @cpuModel = hardware.cpuModel - @cpuMhz = hardware.cpuMhz - - @total_cpu = hardware.numCpuCores*100 - @used_cpu = (stats.overallCpuUsage.to_f / @cpuMhz.to_f) * 100 - @used_cpu = sprintf('%.2f', @used_cpu).to_f # Trim precission - - @total_memory = hardware.memorySize/1024 - @used_memory = stats.overallMemoryUsage*1024 - - net = VIDriver::retrieve_stats([@host], - ["net.packetsRx","net.packetsTx"]) - @netrx = 0 - @nettx = 0 - - if net[@host] && net[@host][:metrics] - if net[@host][:metrics]["net.packetsRx"] - @netrx = net[@host][:metrics]["net.packetsRx"].first - end - - if net[@host][:metrics]["net.packetsTx"] - @nettx = net[@host][:metrics]["net.packetsTx"].first - end - end - - # Check for negative values - @used_memory = 0 if @used_memory.to_i < 0 - @used_cpu = 0 if @used_cpu.to_i < 0 - @netrx = 0 if @netrx.to_i < 0 - @nettx = 0 if @nettx.to_i < 0 - - # Check free datastore space - @free_ds_info = VIDriver::retrieve_free_ds(@host) - end - - ######################################################################## - # Generates a OpenNebula IM Driver valid string with the monitor info - ######################################################################## - def info - str_info = "" - - # CPU - str_info << "MODELNAME=\"" << @cpuModel.to_s << "\"\n" - str_info << "CPUSPEED=" << @cpuMhz.to_s << "\n" - str_info << "TOTALCPU=" << @total_cpu.to_s << "\n" - str_info << "USEDCPU=" << @used_cpu.to_s << "\n" - str_info << "FREECPU=" << (@total_cpu - @used_cpu).to_s << "\n" - - # Memory - str_info << "TOTALMEMORY=" << @total_memory.to_s << "\n" - str_info << "USEDMEMORY=" << @used_memory.to_s << "\n" - str_info << "FREEMEMORY=" << (@total_memory - @used_memory).to_s << "\n" - - # Networking - str_info << "NETRX=" << @netrx.to_s << "\n" - str_info << "NETTX=" << @nettx.to_s << "\n" - - # Datastores - @free_ds_info.each{|k,v| - used_space = v[:capacity].to_i - v[:free_space].to_i - str_info << "DS=[ID=\"#{k}\",USED_MB=#{used_space}," - str_info << "TOTAL_MB=#{v[:capacity]}," - str_info << "FREE_MB=#{v[:free_space]}]\n" - } - - str_info.strip - end - - ######################################################################## - # Generates a OpenNebula IM Driver valid string with the monitor info - # of all VMs defined/running in the ESXi host. - ######################################################################## - def all_vms_info() - str_info = "" - - @host.vm.each { |v| - begin - vivm = VIDriver::VIVm.new("", v) - rescue - next - end - - vivm.monitor - - name = v.name - number = -1 - number = name.split('-').last if (name =~ /^one-\d*$/) - - str_info << "VM = [" - str_info << "ID=#{number}," - str_info << "DEPLOY_ID=\"#{name}\"," - str_info << "POLL=\"#{vivm.info}\"]\n" - } - - return str_info - end - - def vm - @host.vm - end -end - -############################################################################ -# Get performance values for metrics (array) of objects (array) -############################################################################ -def self.retrieve_stats(objects,metrics) - perfManager = @@client.serviceContent.perfManager - - metrics.each do |metric| - return if !perfManager.perfcounter_hash.member? metric - end - - interval = perfManager.provider_summary(objects.first).refreshRate - start_time = nil - - if interval == -1 - interval = 300 - start_time = Time.now - 300 * 5 - end - - stat_opts = { - :interval => interval, - :startTime => start_time, - } - - return perfManager.retrieve_stats(objects, metrics, stat_opts) -end - -def self.retrieve_free_ds(host) - pc = @@client.serviceContent.propertyCollector - hds = host.configManager.datastoreSystem - datastore_props = pc.collectMultiple(hds.datastore, 'summary', 'name') - - free_ds_info=Hash.new - - hds.datastore.each{|ds| - free_ds_info[datastore_props[ds]['name']]=Hash.new - free_ds_info[datastore_props[ds]['name']][:free_space] = - datastore_props[ds]['summary'].freeSpace.to_i / 1024 / 1024 - free_ds_info[datastore_props[ds]['name']][:capacity] = - datastore_props[ds]['summary'].capacity.to_i / 1024 / 1024 - } - - free_ds_info -end - - -def self.root - @@root -end - -def self.host - @@host -end - -end diff --git a/src/vmm_mad/remotes/vmware/vmware_driver.rb b/src/vmm_mad/remotes/vmware/vmware_driver.rb deleted file mode 100644 index a65f64d6f9..0000000000 --- a/src/vmm_mad/remotes/vmware/vmware_driver.rb +++ /dev/null @@ -1,429 +0,0 @@ -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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 'vi_driver' -require "scripts_common" -require 'yaml' -require "CommandManager" -require 'rexml/document' - -class VMwareDriver - # -------------------------------------------------------------------------# - # Set up the environment for the driver # - # -------------------------------------------------------------------------# - ONE_LOCATION = ENV["ONE_LOCATION"] - - if !ONE_LOCATION - BIN_LOCATION = "/usr/bin" - LIB_LOCATION = "/usr/lib/one" - ETC_LOCATION = "/etc/one/" - VAR_LOCATION = "/var/lib/one" - else - LIB_LOCATION = ONE_LOCATION + "/lib" - BIN_LOCATION = ONE_LOCATION + "/bin" - ETC_LOCATION = ONE_LOCATION + "/etc/" - VAR_LOCATION = ONE_LOCATION + "/var/" - end - - CONF_FILE = ETC_LOCATION + "/vmwarerc" - CHECKPOINT = VAR_LOCATION + "/remotes/vmm/vmware/checkpoint" - - ENV['LANG'] = 'C' - - SHUTDOWN_INTERVAL = 5 - SHUTDOWN_TIMEOUT = 500 - - def initialize(host) - conf = YAML::load(File.read(CONF_FILE)) - - @uri = conf[:libvirt_uri].gsub!('@HOST@', host) - @host = host - @reserve_memory = conf[:reserve_memory_in_disk] - - @user = conf[:username] - if conf[:password] and !conf[:password].empty? - @pass=conf[:password] - else - @pass="\"\"" - end - - @datacenter = conf[:datacenter] - @vcenter = conf[:vcenter] - end - - # ######################################################################## # - # VMWARE DRIVER ACTIONS # - # ######################################################################## # - - # ------------------------------------------------------------------------ # - # Deploy & define a VM based on its description file # - # ------------------------------------------------------------------------ # - def deploy(dfile, id) - # Define the domain if it is not already defined (e.g. from UNKNOWN) - - if not domain_defined?(id) - deploy_id = define_domain(dfile) - - exit(-1) if deploy_id.nil? - else - deploy_id = "one-#{id}" - end - - OpenNebula.log_debug("Successfully defined domain #{deploy_id}.") - - # Start the VM - rc, info = do_action("virsh -c #{@uri} start #{deploy_id}") - - if rc == false - undefine_domain(deploy_id) - exit info - end - - return deploy_id - end - - # ------------------------------------------------------------------------ # - # Cancels & undefine the VM # - # ------------------------------------------------------------------------ # - def cancel(deploy_id) - rc, info = do_action("virsh -c #{@uri} --readonly dominfo #{deploy_id}") - - if rc - # Destroy the VM - rc, info = do_action("virsh -c #{@uri} destroy #{deploy_id}") - - exit info if rc == false - - OpenNebula.log_debug("Successfully canceled domain #{deploy_id}.") - end - - # Undefine the VM - undefine_domain(deploy_id) - end - - # ------------------------------------------------------------------------ # - # Reboots a running VM # - # ------------------------------------------------------------------------ # - def reboot(deploy_id) - rc, info = do_action("virsh -c #{@uri} reboot #{deploy_id}") - - exit info if rc == false - - OpenNebula.log_debug("Domain #{deploy_id} successfully rebooted.") - end - - # ------------------------------------------------------------------------ # - # Migrate # - # ------------------------------------------------------------------------ # - def migrate(deploy_id, dst_host, src_host) - src_url = "vpx://#{@vcenter}/#{@datacenter}/#{src_host}/?no_verify=1" - dst_url = "vpx://#{@vcenter}/#{@datacenter}/#{dst_host}/?no_verify=1" - - mgr_cmd = "-r virsh -c #{src_url} migrate #{deploy_id} #{dst_url}" - - rc, info = do_action(mgr_cmd) - - exit info if rc == false - end - - # ------------------------------------------------------------------------ # - # Restore a VM from a previously saved checkpoint # - # ------------------------------------------------------------------------ # - def restore(checkpoint) - begin - vm_id = File.basename(File.dirname(checkpoint)) - vm_folder=VAR_LOCATION << - "/vms/" << vm_id - dfile=`ls -1 #{vm_folder}/deployment*|tail -1` - dfile.strip! - rescue => e - OpenNebula.log_error("Cannot open checkpoint #{e.message}") - exit(-1) - end - - if not domain_defined?(id) - deploy_id = define_domain(dfile) - exit(-1) if deploy_id.nil? - else - deploy_id = "one-#{id}" - end - - # Revert snapshot VM - # Note: This assumes the checkpoint name is "checkpoint", to change - # this it is needed to change also [1] - # - # [1] $ONE_LOCATION/lib/remotes/vmm/vmware/checkpoint - rc = false - 2.times { - rc, info = do_action( - "virsh -c #{@uri} snapshot-revert #{deploy_id} checkpoint") - break if rc == true - } - - exit info if rc == false - - # Delete checkpoint - rc, info = do_action( - "virsh -c #{@uri} snapshot-delete #{deploy_id} checkpoint") - - OpenNebula.log_error("Could not delete snapshot") if rc == false - end - - # ------------------------------------------------------------------------ # - # Saves a VM taking a snapshot # - # ------------------------------------------------------------------------ # - def save(deploy_id) - # Take a snapshot for the VM - rc, info = do_action( - "virsh -c #{@uri} snapshot-create #{deploy_id} #{CHECKPOINT}") - - exit info if rc == false - - # Suspend VM - rc, info = do_action("virsh -c #{@uri} suspend #{deploy_id}") - - exit info if rc == false - - # Undefine VM - undefine_domain(deploy_id) - end - - # ------------------------------------------------------------------------ # - # Shutdown a VM # - # ------------------------------------------------------------------------ # - def shutdown(deploy_id) - rc, info = do_action("virsh -c #{@uri} shutdown #{deploy_id}") - - exit info if rc == false - - counter = 0 - - begin - rc, info = do_action("virsh -c #{@uri} list") - info = "" if rc == false - - sleep SHUTDOWN_INTERVAL - - counter = counter + SHUTDOWN_INTERVAL - end while info.match(deploy_id) and counter < SHUTDOWN_TIMEOUT - - if counter >= SHUTDOWN_TIMEOUT - OpenNebula.error_message( - "Timeout reached, VM #{deploy_id} is still alive") - exit - 1 - end - - undefine_domain(deploy_id) - end - - # ------------------------------------------------------------------------ # - # Creates a new system snapshot # - # ------------------------------------------------------------------------ # - def snapshot_create(deploy_id) - rc, info = do_action( - "virsh -c #{@uri} snapshot-create-as #{deploy_id}") - - exit info if rc == false - - hypervisor_id = info.split[2] - - return hypervisor_id - end - - # ------------------------------------------------------------------------ # - # Delete a system snapshot # - # ------------------------------------------------------------------------ # - def snapshot_delete(deploy_id, snapshot_id) - rc, info = do_action( - "virsh -c #{@uri} snapshot-delete #{deploy_id} #{snapshot_id}") - - exit info if rc == false - end - - # ------------------------------------------------------------------------ # - # Revert to a system snapshot # - # ------------------------------------------------------------------------ # - def snapshot_revert(deploy_id, snapshot_id) - action = "virsh -c #{@uri} snapshot-revert " << - "--force #{deploy_id} #{snapshot_id}" - - rc, info = do_action(action) - - exit info if rc == false - end - - # ######################################################################## # - # DRIVER HELPER FUNCTIONS # - # ######################################################################## # - - private - - #Generates an ESX command using ttyexpect - def esx_cmd(command) - cmd = "#{BIN_LOCATION}/tty_expect -u #{@user} -p #{@pass} #{command}" - end - - #Performs a action usign libvirt - def do_action(cmd, log=true) - rc = LocalCommand.run(esx_cmd(cmd)) - - if rc.code == 0 - return [true, rc.stdout] - else - err = "Error executing: #{cmd} err: #{rc.stderr} out: #{rc.stdout}" - OpenNebula.log_error(err) if log - return [false, rc.code] - end - end - - #Performs a remote action using ssh - def do_ssh_action(cmd, stdin=nil) - rc = SSHCommand.run("'#{cmd}'", @host, nil, stdin) - - if rc.code == 0 - return [true, rc.stdout] - else - err = "Error executing: #{cmd} on host: #{@host} " << - "err: #{rc.stderr} out: #{rc.stdout}" - OpenNebula.log_error(err) - return [false, rc.code] - end - end - - # Undefines a domain in the ESX hypervisor - def undefine_domain(id) - if @vcenter and !@vcenter.empty? and @datacenter and !@datacenter.empty? - undefine_uri = - "vpx://#{@vcenter}/#{@datacenter}/#{@host}/?no_verify=1" - else - undefine_uri = @uri - end - - rc = false - - 30.times do - rc, info = do_action("virsh -c #{undefine_uri} undefine #{id}") - break if rc - sleep 1 - end - - if rc == false - OpenNebula.log_error("Error undefining domain #{id}") - OpenNebula.log_error("Domain #{id} has to be undefined manually") - return rc - end - - return 0 - end - - #defines a domain in the ESX hypervisor - def define_domain(dfile) - deploy_id = nil - rc, info = do_action("virsh -c #{@uri} define #{dfile}") - - return nil if rc == false - - info.split('\n').each{ |line| - mdata = line.match("Domain (.*) defined from (.*)") - - if mdata - deploy_id = mdata[1] - break - end - } - - deploy_id.strip! - - handle_metadata(dfile, deploy_id) - - return deploy_id - end - - def domain_defined?(one_id) - rc, info = do_action("virsh -c #{@uri} dominfo one-#{one_id}", false) - return rc - end - - def handle_metadata(dfile, deploy_id) - dfile_hash = REXML::Document.new(File.open(dfile).read) - - # Check for the known elements in metadata - guestos = REXML::XPath.first(dfile_hash, "/domain/metadata/guestos") - pcibridge = REXML::XPath.first(dfile_hash, "/domain/metadata/pcibridge") - - if (guestos || pcibridge) - VIDriver::initialize(@host, false) - - vivm = VIDriver::VIVm.new(deploy_id, nil) - - vivm.set_guestos(guestos.text) if guestos - - vivm.set_pcibridge(pcibridge.text) if pcibridge - end - - # Append the raw datavmx to vmx file - metadata = REXML::XPath.first(dfile_hash, "/domain/metadata/datavmx") - - if metadata.nil? || metadata.text.nil? || metadata.text.strip.empty? - metadata = '' - else - metadata = metadata.text - end - - if !@reserve_memory - mem_txt = REXML::XPath.first(dfile_hash, "/domain/memory").text - mem = mem_txt.to_i/1024 - - metadata << "\\nsched.mem.min = \"#{mem}\"" - metadata << "\\nsched.mem.shares = \"normal\"" - metadata << "\\nsched.mem.pin = \"TRUE\"" - end - - return if metadata.strip.empty? - - # Get the ds_id for system_ds from the first disk - disk = REXML::XPath.first(dfile_hash, "/domain//disk/source") - source = disk.attributes['file'] - ds_id = source.match(/^\[(.*)\](.*)/)[1] - - name = REXML::XPath.first(dfile_hash, "/domain/name").text - vm_id = name.match(/^one-(.*)/)[1] - - # Reconstruct path to vmx & add metadata - path_to_vmx = "\$(find /vmfs/volumes/#{ds_id}/#{vm_id}/" - path_to_vmx << " -name #{name}.vmx)" - - metadata.gsub!("\\n","\n") - - sed_str = metadata.scan(/^([^ ]+) *=/).join("|") - - cmd_str = "sed -ri \"/^(#{sed_str}) *=.*$/d\" #{path_to_vmx}; " - cmd_str << "cat >> #{path_to_vmx}" - - do_ssh_action(cmd_str, metadata) - end -end diff --git a/src/vmm_mad/remotes/vmware/vmwarerc b/src/vmm_mad/remotes/vmware/vmwarerc deleted file mode 100644 index ed3b986d51..0000000000 --- a/src/vmm_mad/remotes/vmware/vmwarerc +++ /dev/null @@ -1,30 +0,0 @@ -# ---------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -# ---------------------------------------------------------------------------- # - -# Libvirt congfiguration -:libvirt_uri: "'esx://@HOST@/?no_verify=1&auto_answer=1'" - -# Username and password of the VMware hypervisor -:username: "oneadmin" -:password: - -# VMotion configuration attributes -:datacenter: "ha-datacenter" -:vcenter: - -# true to instruct ESX to create vswp files with disk reservation -# for memory, false for the vice versa -:reserve_memory_in_disk: true diff --git a/src/vnm_mad/remotes/lib/nic.rb b/src/vnm_mad/remotes/lib/nic.rb index ae05ffe873..0fdacc3c7d 100644 --- a/src/vnm_mad/remotes/lib/nic.rb +++ b/src/vnm_mad/remotes/lib/nic.rb @@ -86,24 +86,6 @@ module VNMNetwork self end end - - # A NIC using VMware. This class implements functions to get the physical interface - # that the NIC is using - class NicVMware < Hash - VNMNetwork::HYPERVISORS["vmware"] = self - - def initialize - super(nil) - end - - def get_info(vm) - end - - def get_tap(vm) - self - end - end - end end diff --git a/src/vnm_mad/remotes/vmware/VMware.rb b/src/vnm_mad/remotes/vmware/VMware.rb deleted file mode 100644 index 8987dddc7e..0000000000 --- a/src/vnm_mad/remotes/vmware/VMware.rb +++ /dev/null @@ -1,114 +0,0 @@ -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -# ---------------------------------------------------------------------------# -# Set up the environment for the driver # -# ---------------------------------------------------------------------------# -ONE_LOCATION = ENV["ONE_LOCATION"] - -if !ONE_LOCATION - ETC_LOCATION = "/etc/one/" - RUBY_LIB_LOCATION = "/usr/lib/one/ruby" -else - ETC_LOCATION = ONE_LOCATION + "/etc/" - RUBY_LIB_LOCATION = ONE_LOCATION + "/lib/ruby" -end - -CONF_FILE = ETC_LOCATION + "/vmwarerc" - -$: << RUBY_LIB_LOCATION -# ---------------------------------------------------------------------------# - -require 'yaml' -require 'CommandManager' -require 'vnmmad' - -class OpenNebulaVMware < VNMMAD::VNMDriver - - DRIVER = "vmware" - XPATH_FILTER = "TEMPLATE/NIC[VN_MAD='vmware']" - VCLI_CMD = "/sbin/esxcfg-vswitch" - - def initialize(vm, deploy_id = nil, hypervisor = nil) - super(vm,XPATH_FILTER,deploy_id,hypervisor) - - @locking = false - @config = YAML::load(File.read(CONF_FILE)) - end - - def activate - lock - - vm_id = @vm['ID'] - host = @vm['HISTORY_RECORDS/HISTORY/HOSTNAME'] - process do |nic| - switch = nic[:bridge] - network_id = nic[:network_id] - pg = "one-pg-#{network_id}" - - if nic[:vlan] == "YES" - if nic[:vlan_id] - vlan = nic[:vlan_id] - else - if nic[:parent_network_id] - network_id = nic[:parent_network_id].to_i - else - network_id = nic[:network_id].to_i - end - - vlan = CONF[:start_vlan] + network_id - - end - else - vlan = nil - end - - add_pg_to_switch(host, pg, switch, vlan) - end - - unlock - return 0 - end - -private - - # Add port group to switch in host, and sets vlan if available - def add_pg_to_switch(host, pg, switch, vlan) - # Check's first if the vSwitch exists - add_pg_cmd = "((esxcfg-vswitch #{switch} -l|grep #{pg})" - add_pg_cmd << " || #{VCLI_CMD} #{switch} --add-pg #{pg})" - - if vlan - add_pg_cmd << "; #{VCLI_CMD} #{switch} -p #{pg} --vlan=#{vlan}" - end - - do_ssh_action(add_pg_cmd, host) - end - - # Performs a remote action in host using ssh - def do_ssh_action(cmd, host) - rc = SSHCommand.run("'#{cmd}'", host, nil, nil) - - if rc.code == 0 - return [true, rc.stdout] - else - err = "Error executing: #{cmd} on host: #{@host} " << - "err: #{rc.stderr} out: #{rc.stdout}" - OpenNebula.log_error(err) - return [false, rc.code] - end - end -end diff --git a/src/vnm_mad/remotes/vmware/clean b/src/vnm_mad/remotes/vmware/clean deleted file mode 100755 index 6ea8f4e0a3..0000000000 --- a/src/vnm_mad/remotes/vmware/clean +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -exit 0 diff --git a/src/vnm_mad/remotes/vmware/post b/src/vnm_mad/remotes/vmware/post deleted file mode 100755 index 6ea8f4e0a3..0000000000 --- a/src/vnm_mad/remotes/vmware/post +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # - -exit 0 diff --git a/src/vnm_mad/remotes/vmware/pre b/src/vnm_mad/remotes/vmware/pre deleted file mode 100755 index 3c40552251..0000000000 --- a/src/vnm_mad/remotes/vmware/pre +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env ruby - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # -# $stdout = $stderr - -$: << File.dirname(__FILE__) -$: << File.join(File.dirname(__FILE__), "..") - -require 'VMware' - -deploy_id = nil -hypervisor = "vmware" -vm_64 = ARGV[0] - -vmware = OpenNebulaVMware.from_base64(vm_64, deploy_id, hypervisor) -exit vmware.activate diff --git a/src/vnm_mad/remotes/vmware/update_sg b/src/vnm_mad/remotes/vmware/update_sg deleted file mode 100755 index 9818bbf4c3..0000000000 --- a/src/vnm_mad/remotes/vmware/update_sg +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2015, 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. # -#--------------------------------------------------------------------------- # -source $(dirname $0)/../../scripts_common.sh - -log_error "Security groups not supported for vmware" -exit 1 \ No newline at end of file