From 81fd8e353b0e171d6ce0c0fcf6d544a7dd646734 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 26 Feb 2026 19:24:53 +0100 Subject: [PATCH] Revert "F #7373: FSaaS (File System as a Service) for OpenNebula" This reverts commit fa72e8fd7f905e9eed3796d62cb6d9dddaededf4. --- include/Image.h | 34 +++-- include/VirtualMachine.h | 16 --- include/VirtualMachineDisk.h | 11 -- install.sh | 12 -- share/etc/oned.conf | 6 +- src/datastore/Datastore.cc | 3 - src/datastore_mad/remotes/virtiofs/clone | 1 - src/datastore_mad/remotes/virtiofs/cp | 71 ----------- src/datastore_mad/remotes/virtiofs/mkfs | 1 - src/datastore_mad/remotes/virtiofs/monitor | 24 ---- src/datastore_mad/remotes/virtiofs/rm | 21 ---- .../remotes/virtiofs/snap_delete | 1 - .../remotes/virtiofs/snap_flatten | 1 - .../remotes/virtiofs/snap_revert | 1 - src/datastore_mad/remotes/virtiofs/stat | 23 ---- src/image/Image.cc | 38 +----- src/image/ImageManagerActions.cc | 26 ++-- src/image/ImagePool.cc | 1 - .../org/opennebula/client/image/Image.java | 4 +- src/oca/python/pyone/__init__.py | 4 +- src/oca/ruby/opennebula/image.rb | 19 ++- src/rm/api/ImageAPI.cc | 10 +- src/rm/api/VirtualMachineAPI.cc | 68 ---------- src/tm/TransferManager.cc | 13 -- src/tm_mad/lib/tm_action.rb | 2 +- src/tm_mad/local/clone | 7 -- src/vm/VirtualMachine.cc | 6 - src/vm/VirtualMachineContext.cc | 119 ------------------ src/vm/VirtualMachineDisk.cc | 35 +----- src/vm/VirtualMachinePool.cc | 5 - src/vmm/LibVirtDriverKVM.cc | 47 +------ 31 files changed, 48 insertions(+), 582 deletions(-) delete mode 120000 src/datastore_mad/remotes/virtiofs/clone delete mode 100755 src/datastore_mad/remotes/virtiofs/cp delete mode 120000 src/datastore_mad/remotes/virtiofs/mkfs delete mode 100755 src/datastore_mad/remotes/virtiofs/monitor delete mode 100755 src/datastore_mad/remotes/virtiofs/rm delete mode 120000 src/datastore_mad/remotes/virtiofs/snap_delete delete mode 120000 src/datastore_mad/remotes/virtiofs/snap_flatten delete mode 120000 src/datastore_mad/remotes/virtiofs/snap_revert delete mode 100755 src/datastore_mad/remotes/virtiofs/stat diff --git a/include/Image.h b/include/Image.h index 92bde3b9ca..838dc488af 100644 --- a/include/Image.h +++ b/include/Image.h @@ -36,14 +36,13 @@ public: */ enum ImageType { - OS = 0, /** < Base OS image */ - CDROM = 1, /** < An ISO9660 image */ - DATABLOCK = 2, /** < User persistent data device */ - KERNEL = 3, /** < Kernel files */ - RAMDISK = 4, /** < Initrd files */ - CONTEXT = 5, /** < Context files */ - BACKUP = 6, /** < VM Backup reference */ - FILESYSTEM = 7, /** < Filesystem */ + OS = 0, /** < Base OS image */ + CDROM = 1, /** < An ISO9660 image */ + DATABLOCK = 2, /** < User persistent data device */ + KERNEL = 3, /** < Kernel files */ + RAMDISK = 4, /** < Initrd files */ + CONTEXT = 5, /** < Context files */ + BACKUP = 6, /** < VM Backup reference */ }; /** @@ -55,15 +54,14 @@ public: { switch (ob) { - case OS: return "OS" ; break; - case CDROM: return "CDROM" ; break; - case DATABLOCK: return "DATABLOCK" ; break; - case KERNEL: return "KERNEL" ; break; - case RAMDISK: return "RAMDISK" ; break; - case CONTEXT: return "CONTEXT" ; break; - case BACKUP: return "BACKUP" ; break; - case FILESYSTEM: return "FILESYSTEM" ; break; - default: return ""; + case OS: return "OS" ; break; + case CDROM: return "CDROM" ; break; + case DATABLOCK: return "DATABLOCK" ; break; + case KERNEL: return "KERNEL" ; break; + case RAMDISK: return "RAMDISK" ; break; + case CONTEXT: return "CONTEXT" ; break; + case BACKUP: return "BACKUP" ; break; + default: return ""; } }; @@ -90,7 +88,6 @@ public: SHEEPDOG = 7, /** < Sheepdog Block Device */ SHEEPDOG_CDROM = 8, /** < Sheepdog CDROM Device Device */ ISCSI = 9, /** < iSCSI Volume (Devices Datastore) */ - FILE_SYSTEM = 10, /** < Filesystem */ NONE = 255 /** < No disk type, error situation */ }; @@ -113,7 +110,6 @@ public: case SHEEPDOG: return "SHEEPDOG" ; break; case SHEEPDOG_CDROM: return "SHEEPDOG_CDROM" ; break; case ISCSI: return "ISCSI" ; break; - case FILE_SYSTEM: return "FILESYSTEM" ; break; default: return ""; } }; diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index c20361d34e..03d63d8d96 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -2293,22 +2293,6 @@ private: */ void add_pci_context(VectorAttribute * pci); - /** - * Generate the DISK related CONTEXT setions, i.e. DISK_*. This function is - * used only for disks skipped during requirements process(i.e. FILESYSTEM) - * @param context attribute of the VM - * @param error string if any - * @return 0 on success - */ - int generate_disk_context(VectorAttribute* context, std::string& error_str); - - /** - * Deletes the DISK related CONTEXT section for the given disk, i.e. - * DISK_TAG - * @param disk_id the id of the DISK - */ - void clear_disk_context(int disk_id); - /** * Generate the ONE_GATE token & url * @param context attribute of the VM diff --git a/include/VirtualMachineDisk.h b/include/VirtualMachineDisk.h index c0daa80827..622709647d 100644 --- a/include/VirtualMachineDisk.h +++ b/include/VirtualMachineDisk.h @@ -22,7 +22,6 @@ #include #include "VirtualMachineAttribute.h" -#include "Image.h" #include "Snapshots.h" #include "NebulaUtil.h" @@ -378,16 +377,6 @@ public: */ void to_xml_short(std::ostringstream& oss) const; - /* ---------------------------------------------------------------------- */ - /* Disk requirements helpers */ - /* ---------------------------------------------------------------------- */ - /** - * Checks if the disk should be skipped when computing VM requirements - * - * @return true if the disk should be skipped - */ - bool skip_disk() const; - private: Snapshots * snapshots; diff --git a/install.sh b/install.sh index 4274cea8c5..1911a80826 100755 --- a/install.sh +++ b/install.sh @@ -446,7 +446,6 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/datastore/iscsi_libvirt \ $VAR_LOCATION/remotes/datastore/rsync \ $VAR_LOCATION/remotes/datastore/restic \ - $VAR_LOCATION/remotes/datastore/virtiofs \ $VAR_LOCATION/remotes/market \ $VAR_LOCATION/remotes/market/http \ $VAR_LOCATION/remotes/market/one \ @@ -629,7 +628,6 @@ INSTALL_FILES=( DATASTORE_DRIVER_ISCSI_SCRIPTS:$VAR_LOCATION/remotes/datastore/iscsi_libvirt DATASTORE_DRIVER_RSYNC_SCRIPTS:$VAR_LOCATION/remotes/datastore/rsync DATASTORE_DRIVER_RESTIC_SCRIPTS:$VAR_LOCATION/remotes/datastore/restic - DATASTORE_DRIVER_VIRTIOFS_SCRIPTS:$VAR_LOCATION/remotes/datastore/virtiofs DATASTORE_DRIVER_ETC_SCRIPTS:$VAR_LOCATION/remotes/etc/datastore MARKETPLACE_DRIVER_HTTP_SCRIPTS:$VAR_LOCATION/remotes/market/http @@ -1704,16 +1702,6 @@ DATASTORE_DRIVER_RESTIC_SCRIPTS="src/datastore_mad/remotes/restic/cp \ src/datastore_mad/remotes/restic/backup_cancel \ src/datastore_mad/remotes/restic/ls" -DATASTORE_DRIVER_VIRTIOFS_SCRIPTS="src/datastore_mad/remotes/virtiofs/clone \ - src/datastore_mad/remotes/virtiofs/cp \ - src/datastore_mad/remotes/virtiofs/mkfs \ - src/datastore_mad/remotes/virtiofs/monitor \ - src/datastore_mad/remotes/virtiofs/rm \ - src/datastore_mad/remotes/virtiofs/snap_delete \ - src/datastore_mad/remotes/virtiofs/snap_flatten \ - src/datastore_mad/remotes/virtiofs/snap_revert \ - src/datastore_mad/remotes/virtiofs/stat" - DATASTORE_DRIVER_ETC_SCRIPTS="src/datastore_mad/remotes/datastore.conf" #------------------------------------------------------------------------------- diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 2005c676d5..e132012963 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -558,7 +558,7 @@ TM_MAD = [ DATASTORE_MAD = [ EXECUTABLE = "one_datastore", - ARGUMENTS = "-t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,restic,rsync,netapp,purefa,virtiofs -s dummy,lvm,shared,ssh,local,ceph,fs_lvm,fs_lvm_ssh,qcow2,netapp,purefa" + ARGUMENTS = "-t 15 -d dummy,fs,lvm,ceph,dev,iscsi_libvirt,restic,rsync,netapp,purefa -s dummy,lvm,shared,ssh,local,ceph,fs_lvm,fs_lvm_ssh,qcow2,netapp,purefa" ] #******************************************************************************* @@ -1266,10 +1266,6 @@ DS_MAD_CONF = [ NAME = "purefa", PERSISTENT_ONLY = "NO", MARKETPLACE_ACTIONS = "export", REQUIRED_ATTRS = "PUREFA_HOST,PUREFA_API_TOKEN,PUREFA_TARGET" ] -DS_MAD_CONF = [ - NAME = "virtiofs", REQUIRED_ATTRS = "", PERSISTENT_ONLY = "YES", - MARKETPLACE_ACTIONS = "export" -] #******************************************************************************* # MarketPlace Driver Behavior Configuration diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc index df7369927d..9223286d7a 100644 --- a/src/datastore/Datastore.cc +++ b/src/datastore/Datastore.cc @@ -583,7 +583,6 @@ int Datastore::set_ds_disk_type(string& s_dt, string& error) case Image::RBD: case Image::GLUSTER: case Image::SHEEPDOG: - case Image::FILE_SYSTEM: break; case Image::CD_ROM: @@ -606,7 +605,6 @@ int Datastore::set_ds_disk_type(string& s_dt, string& error) case Image::FILE: case Image::RBD: case Image::BLOCK: - case Image::FILE_SYSTEM: break; case Image::GLUSTER: @@ -1276,7 +1274,6 @@ Image::DiskType Datastore::context_disk_type() const case Image::RBD_CDROM: case Image::SHEEPDOG_CDROM: case Image::GLUSTER_CDROM: - case Image::FILE_SYSTEM: break; } diff --git a/src/datastore_mad/remotes/virtiofs/clone b/src/datastore_mad/remotes/virtiofs/clone deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/virtiofs/clone +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/virtiofs/cp b/src/datastore_mad/remotes/virtiofs/cp deleted file mode 100755 index b7a5253d5a..0000000000 --- a/src/datastore_mad/remotes/virtiofs/cp +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2025, 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 or register a directory to the repository -############################################################################### - -# -------- 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 cp and datastore arguments from OpenNebula core ------------ - -DRV_ACTION=`cat -` -ID=$1 - -export DRV_ACTION - -UTILS_PATH="${DRIVER_PATH}/.." - -XPATH="$UTILS_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/RESTRICTED_DIRS \ - /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \ - /DS_DRIVER_ACTION_DATA/IMAGE/PATH) - -unset i - -BASE_PATH="${XPATH_ELEMENTS[i++]}" -RESTRICTED_DIRS="${XPATH_ELEMENTS[i++]}" -SAFE_DIRS="${XPATH_ELEMENTS[i++]}" -SRC="${XPATH_ELEMENTS[i++]}" - -set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" - -if [ `check_restricted $SRC` -eq 1 ]; then - log_error "Not allowed to use directories from $RESTRICTED_DIRS" - error_message "Not allowed to use directory '$SRC', check RESTRICTED_DIRS in your datastore" - exit -1 -fi - -echo "$SRC dir" diff --git a/src/datastore_mad/remotes/virtiofs/mkfs b/src/datastore_mad/remotes/virtiofs/mkfs deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/virtiofs/mkfs +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/virtiofs/monitor b/src/datastore_mad/remotes/virtiofs/monitor deleted file mode 100755 index d551169772..0000000000 --- a/src/datastore_mad/remotes/virtiofs/monitor +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2025, 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. # -#--------------------------------------------------------------------------- # -STDIN=`cat -` - -echo "USED_MB=0" -echo "TOTAL_MB=1" -echo "FREE_MB=1" - -exit 0 diff --git a/src/datastore_mad/remotes/virtiofs/rm b/src/datastore_mad/remotes/virtiofs/rm deleted file mode 100755 index 353840e115..0000000000 --- a/src/datastore_mad/remotes/virtiofs/rm +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2025, 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. # -#--------------------------------------------------------------------------- # - -STDIN=`cat -` - -exit 0 diff --git a/src/datastore_mad/remotes/virtiofs/snap_delete b/src/datastore_mad/remotes/virtiofs/snap_delete deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/virtiofs/snap_delete +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/virtiofs/snap_flatten b/src/datastore_mad/remotes/virtiofs/snap_flatten deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/virtiofs/snap_flatten +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/virtiofs/snap_revert b/src/datastore_mad/remotes/virtiofs/snap_revert deleted file mode 120000 index 9c454e8cd4..0000000000 --- a/src/datastore_mad/remotes/virtiofs/snap_revert +++ /dev/null @@ -1 +0,0 @@ -../common/not_supported.sh \ No newline at end of file diff --git a/src/datastore_mad/remotes/virtiofs/stat b/src/datastore_mad/remotes/virtiofs/stat deleted file mode 100755 index 8053c0376a..0000000000 --- a/src/datastore_mad/remotes/virtiofs/stat +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# -------------------------------------------------------------------------- # -# Copyright 2002-2025, 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. # -#--------------------------------------------------------------------------- # - -STDIN=`cat -` - -echo "0" - -exit 0 diff --git a/src/image/Image.cc b/src/image/Image.cc index 40745092e6..3a124e687a 100644 --- a/src/image/Image.cc +++ b/src/image/Image.cc @@ -135,11 +135,6 @@ int Image::insert(SqlDB *db, string& error_str) } break; - case FILESYSTEM: - persistent_img = one_util::icasecmp(persistent_attr, "YES"); - erase_template_attribute("DEV_PREFIX", dev_prefix); - break; - case CDROM: // dev_prefix set based on VM chipset and use custom SAVE,CLONE case KERNEL: // Files are always non-persistent with no dev_prefix case RAMDISK: @@ -229,19 +224,6 @@ int Image::insert(SqlDB *db, string& error_str) } // else format in the IMAGE template } - else if (type == Image::FILESYSTEM) - { - // FILESYSTEM image must use dir format - if (format.empty()) - { - format = "dir"; // default - } - else if (one_util::icasecmp(format, "dir") != 0) - { - error_str = "FORMAT for FILESYSTEM images must be 'dir'."; - goto error_common; - } - } else //CDROM, KERNEL, RAMDISK, CONTEXT { error_str = "No PATH nor SOURCE in template."; @@ -591,7 +573,7 @@ void Image::disk_attribute(VirtualMachineDisk * disk, // DEV_PREFIX ATTRIBUTE // Note: CD's dev_prefix is set on target assigment based on VM chipset //-------------------------------------------------------------------------- - if ( dev_prefix.empty() && !(type == CDROM || type == FILESYSTEM) ) + if ( dev_prefix.empty() && type != CDROM ) { get_template_attribute("DEV_PREFIX", dev_prefix); @@ -664,7 +646,7 @@ void Image::disk_attribute(VirtualMachineDisk * disk, disk->replace("CLONE", "NO"); disk->replace("SAVE", "YES"); - if (template_ptype == "SHAREABLE" && (format == "raw" || format == "dir")) + if (template_ptype == "SHAREABLE" && format == "raw") { disk->replace("SHAREABLE", "YES"); } @@ -721,10 +703,6 @@ void Image::disk_attribute(VirtualMachineDisk * disk, disk_attr_type = disk_type_to_str(new_disk_type); break; - case FILESYSTEM: - disk_attr_type = disk_type_to_str(FILE_SYSTEM); - break; - default: //Other file types should not be never a DISK break; } @@ -814,10 +792,6 @@ int Image::set_type(string& _type, string& error) { type = BACKUP; } - else if ( _type == "FILESYSTEM" ) - { - type = FILESYSTEM; - } else { error = "Unknown type " + type; @@ -895,10 +869,6 @@ Image::ImageType Image::str_to_type(string& str_type) { it = BACKUP; } - else if ( str_type == "FILESYSTEM" ) - { - it = FILESYSTEM; - } return it; } @@ -1009,10 +979,6 @@ Image::DiskType Image::str_to_disk_type(string& s_disk_type) { type = Image::ISCSI; } - else if (s_disk_type == "FILESYSTEM") - { - type = Image::FILE_SYSTEM; - } return type; } diff --git a/src/image/ImageManagerActions.cc b/src/image/ImageManagerActions.cc index f5569ab2bb..f98c570263 100644 --- a/src/image/ImageManagerActions.cc +++ b/src/image/ImageManagerActions.cc @@ -99,7 +99,6 @@ int ImageManager::acquire_image(int vm_id, Image *img, bool attach, string& erro case Image::OS: case Image::DATABLOCK: case Image::CDROM: - case Image::FILESYSTEM: break; case Image::KERNEL: @@ -239,7 +238,6 @@ void ImageManager::release_image(int vm_id, int iid, bool failed) case Image::OS: case Image::DATABLOCK: case Image::CDROM: - case Image::FILESYSTEM: break; case Image::KERNEL: @@ -354,9 +352,8 @@ void ImageManager::release_cloning_resource( case Image::RAMDISK: case Image::CONTEXT: case Image::BACKUP: - case Image::FILESYSTEM: - NebulaLog::log("ImM", Log::ERROR, "Trying to release a cloning " + - img->type_to_str(img->get_type()) + " image"); + NebulaLog::log("ImM", Log::ERROR, "Trying to release a cloning " + "KERNEL, RAMDISK, BACKUP or CONTEXT image"); return; } @@ -918,11 +915,6 @@ int ImageManager::stat_image(Template* img_tmpl, switch (Image::str_to_type(type_att)) { - case Image::FILESYSTEM: - res = "0"; - - return 0; - case Image::BACKUP: if ( img_tmpl->get("SIZE", res) ) { @@ -1086,7 +1078,6 @@ void ImageManager::set_image_snapshots(int iid, const Snapshots& s) case Image::CONTEXT: case Image::CDROM: case Image::BACKUP: - case Image::FILESYSTEM: return; } @@ -1140,7 +1131,6 @@ void ImageManager::set_image_size(int iid, long long size) case Image::CONTEXT: case Image::CDROM: case Image::BACKUP: - case Image::FILESYSTEM: return; } @@ -1210,8 +1200,8 @@ int ImageManager::delete_snapshot(int iid, int sid, string& error) if ( img->get_type() != Image::OS && img->get_type() != Image::DATABLOCK ) { - error = "IMAGES of type KERNEL, RAMDISK, BACKUP, FILESYSTEM and " - "CONTEXT does not have snapshots."; + error = "IMAGES of type KERNEL, RAMDISK, BACKUP and CONTEXT does not " + "have snapshots."; return -1; } @@ -1304,8 +1294,8 @@ int ImageManager::revert_snapshot(int iid, int sid, string& error) if ( img->get_type() != Image::OS && img->get_type() != Image::DATABLOCK ) { - error = "IMAGES of type KERNEL, RAMDISK, BACKUP, FILESYSTEM and " - "CONTEXT does not have snapshots."; + error = "IMAGES of type KERNEL, RAMDISK, BACKUP and CONTEXT does not " + "have snapshots."; return -1; } @@ -1400,8 +1390,8 @@ int ImageManager::flatten_snapshot(int iid, int sid, string& error) if ( img->get_type() != Image::OS && img->get_type() != Image::DATABLOCK ) { - error = "IMAGES of type KERNEL, RAMDISK, BACKUP, FILESYSTEM and " - "CONTEXT does not have snapshots."; + error = "IMAGES of type KERNEL, RAMDISK, BACKUP and CONTEXT does not " + "have snapshots."; return -1; } diff --git a/src/image/ImagePool.cc b/src/image/ImagePool.cc index 2ed1da6ab3..95454f244a 100644 --- a/src/image/ImagePool.cc +++ b/src/image/ImagePool.cc @@ -117,7 +117,6 @@ int ImagePool::allocate ( case Image::OS: case Image::DATABLOCK: case Image::CDROM: - case Image::FILESYSTEM: if ( ds_type != Datastore::IMAGE_DS ) { error_str = "Only IMAGES of type KERNEL, RAMDISK and CONTEXT can be" diff --git a/src/oca/java/src/org/opennebula/client/image/Image.java b/src/oca/java/src/org/opennebula/client/image/Image.java index dfb28fb51c..69d7fd1716 100644 --- a/src/oca/java/src/org/opennebula/client/image/Image.java +++ b/src/oca/java/src/org/opennebula/client/image/Image.java @@ -55,10 +55,10 @@ public class Image extends PoolElement "lock", "lock"}; private static final String[] IMAGE_TYPES = - {"OS", "CDROM", "DATABLOCK", "KERNEL", "RAMDISK", "CONTEXT", "FILESYSTEM"}; + {"OS", "CDROM", "DATABLOCK", "KERNEL", "RAMDISK", "CONTEXT"}; private static final String[] SHORT_IMAGE_TYPES = - {"OS", "CD", "DB", "KL", "RD", "CX", "FS"}; + {"OS", "CD", "DB", "KL", "RD", "CX"}; /** * Creates a new Image representation. diff --git a/src/oca/python/pyone/__init__.py b/src/oca/python/pyone/__init__.py index 4f7689de2f..2c644659da 100644 --- a/src/oca/python/pyone/__init__.py +++ b/src/oca/python/pyone/__init__.py @@ -58,7 +58,7 @@ class OneInternalException(OneException): DATASTORE_TYPES = IntEnum('DATASTORE_TYPES', 'IMAGE SYSTEM FILE', start=0) DATASTORE_STATES = IntEnum('DATASTORE_STATES', 'READY DISABLED', start=0) -DISK_TYPES = IntEnum('DISK_TYPES', 'FILE CD_ROM BLOCK RBD FILE_SYSTEM', start=0) +DISK_TYPES = IntEnum('DISK_TYPES', 'FILE CD_ROM BLOCK RBD', start=0) HISTORY_ACTION = IntEnum('HISTORY_ACTION', '''none migrate live-migrate shutdown shutdown-hard undeploy undeploy-hard hold release stop @@ -79,7 +79,7 @@ IMAGE_STATES = IntEnum('IMAGE_STATES', '''INIT READY USED DISABLED LOCKED ERROR CLONE DELETE USED_PERS LOCKED_USED LOCKED_USED_PERS''', start=0) IMAGE_TYPES = IntEnum('IMAGE_TYPES', '''OS CDROM DATABLOCK KERNEL RAMDISK - CONTEXT FILESYSTEM''', start=0) + CONTEXT''', start=0) LCM_STATE = IntEnum('LCM_STATE', ''' LCM_INIT diff --git a/src/oca/ruby/opennebula/image.rb b/src/oca/ruby/opennebula/image.rb index 041ea0d934..db301423dd 100644 --- a/src/oca/ruby/opennebula/image.rb +++ b/src/oca/ruby/opennebula/image.rb @@ -62,20 +62,19 @@ module OpenNebula "LOCKED_USED_PERS" => "lock" } - IMAGE_TYPES=%w{OS CDROM DATABLOCK KERNEL RAMDISK CONTEXT BACKUP FILESYSTEM} + IMAGE_TYPES=%w{OS CDROM DATABLOCK KERNEL RAMDISK CONTEXT BACKUP} SHORT_IMAGE_TYPES={ - "OS" => "OS", - "CDROM" => "CD", - "DATABLOCK" => "DB", - "KERNEL" => "KL", - "RAMDISK" => "RD", - "CONTEXT" => "CX", - "BACKUP" => "BK", - "FILESYSTEM" => "FS" + "OS" => "OS", + "CDROM" => "CD", + "DATABLOCK" => "DB", + "KERNEL" => "KL", + "RAMDISK" => "RD", + "CONTEXT" => "CX", + "BACKUP" => "BK" } - DISK_TYPES=%w{FILE CD_ROM BLOCK RBD FILE_SYSTEM} + DISK_TYPES=%w{FILE CD_ROM BLOCK RBD} # Creates an Image description with just its identifier # this method should be used to create plain Image objects. diff --git a/src/rm/api/ImageAPI.cc b/src/rm/api/ImageAPI.cc index 39f9f1cdc2..102ec4aa21 100644 --- a/src/rm/api/ImageAPI.cc +++ b/src/rm/api/ImageAPI.cc @@ -107,10 +107,7 @@ Request::ErrorCode ImageAPI::clone(int source_id, case Image::RAMDISK: case Image::CONTEXT: case Image::BACKUP: - case Image::FILESYSTEM: - string type = img->type_to_str(img->get_type()); - att.resp_msg = type + " images cannot be cloned."; - + att.resp_msg = "KERNEL, RAMDISK, BACKUP and CONTEXT cannot be cloned."; return Request::ACTION; } @@ -398,7 +395,6 @@ Request::ErrorCode ImageAPI::persistent(int oid, case Image::OS: case Image::DATABLOCK: case Image::CDROM: - case Image::FILESYSTEM: break; case Image::KERNEL: @@ -496,9 +492,7 @@ Request::ErrorCode ImageAPI::change_type(int oid, } break; case Image::BACKUP: - case Image::FILESYSTEM: - string ctype = image->type_to_str(image->get_type()); - att.resp_msg = "Cannot change type for" + ctype + " images."; + att.resp_msg = "Cannot change type for BACKUP images."; return Request::ACTION; } diff --git a/src/rm/api/VirtualMachineAPI.cc b/src/rm/api/VirtualMachineAPI.cc index b236f7e0a5..923b455c3b 100644 --- a/src/rm/api/VirtualMachineAPI.cc +++ b/src/rm/api/VirtualMachineAPI.cc @@ -1256,7 +1256,6 @@ Request::ErrorCode VirtualMachineAPI::disk_save_as(int vid, case Image::RAMDISK: case Image::CONTEXT: case Image::BACKUP: - case Image::FILESYSTEM: goto error_image_type; } @@ -1466,14 +1465,6 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_create(int vid, return Request::ACTION; } - if (disk->skip_disk()) - { - att.resp_msg = "Action \"disk-snapshot-create\" is not compatible with " - "disks " + disk->vector_value("TYPE"); - - return Request::ACTION; - } - /* ---------------------------------------------------------------------- */ /* Get disk information and quota usage deltas */ /* ---------------------------------------------------------------------- */ @@ -1643,14 +1634,6 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_delete(int vid, return Request::ACTION; } - if (disk->skip_disk()) - { - att.resp_msg = "Action \"disk-snapshot-delete\" is not compatible with " - "disks " + disk->vector_value("TYPE"); - - return Request::ACTION; - } - persistent = disk->is_persistent(); disk->vector_value("IMAGE_ID", img_id); @@ -1719,28 +1702,6 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_revert(int vid, int snap_id, RequestAttributes& att) { - const VirtualMachineDisk * disk; - - if (auto vm = vmpool->get_ro(vid)) - { - disk = vm->get_disk(disk_id); - - if (disk == nullptr) - { - att.resp_msg = "VM disk does not exist"; - - return Request::ACTION; - } - - if (disk->skip_disk()) - { - att.resp_msg = "Action \"disk-snapshot-revert\" is not compatible with " - "disks " + disk->vector_value("TYPE"); - - return Request::ACTION; - } - } - // Authorize the request att.set_auth_op(VMActions::DISK_SNAPSHOT_REVERT_ACTION); @@ -1797,14 +1758,6 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_rename(int vid, return Request::ACTION; } - if (disk->skip_disk()) - { - att.resp_msg = "Action \"disk-snapshot-rename\" is not compatible with " - "disks " + disk->vector_value("TYPE"); - - return Request::ACTION; - } - int rc = vm->rename_disk_snapshot(disk_id, snap_id, new_name, att.resp_msg); if ( rc != 0 ) @@ -2014,27 +1967,6 @@ Request::ErrorCode VirtualMachineAPI::disk_detach(int vid, return Request::NO_EXISTS; } - const VirtualMachineDisk * disk; - - if (auto vm = vmpool->get_ro(vid)) - { - disk = vm->get_disk(disk_id); - - if (disk == nullptr) - { - att.resp_msg = "VM disk does not exist"; - - return Request::ACTION; - } - - if (disk->skip_disk()) - { - att.resp_msg = "Can not detach disks " + disk->vector_value("TYPE"); - - return Request::ACTION; - } - } - auto dm = Nebula::instance().get_dm(); int rc = dm->detach(vid, disk_id, att, att.resp_msg); diff --git a/src/tm/TransferManager.cc b/src/tm/TransferManager.cc index aa1c22e968..bc9c87bec9 100644 --- a/src/tm/TransferManager.cc +++ b/src/tm/TransferManager.cc @@ -132,19 +132,6 @@ int TransferManager::prolog_transfer_command( << vm->get_ds_id() << endl; } - else if ( type == "FILESYSTEM" ) - { - const string& target = disk->vector_value("TARGET"); - - if ( target.empty() ) - { - os << "No target in FILESYSTEM disk"; - - return -1; - } - - return 0; - } else { // ----------------------------------------------------------------- diff --git a/src/tm_mad/lib/tm_action.rb b/src/tm_mad/lib/tm_action.rb index b6df8f0b5a..c8d24d34aa 100644 --- a/src/tm_mad/lib/tm_action.rb +++ b/src/tm_mad/lib/tm_action.rb @@ -461,7 +461,7 @@ module TransferManager disk_format = disk_attribute(disk_id, 'FORMAT') case disk_format - when 'raw', 'qcow2', 'dir' + when 'raw', 'qcow2' disk_format.to_sym end end diff --git a/src/tm_mad/local/clone b/src/tm_mad/local/clone index e0ba4e69d8..9106d5a9e4 100755 --- a/src/tm_mad/local/clone +++ b/src/tm_mad/local/clone @@ -204,13 +204,6 @@ script, host = popd SCRIPT - when :dir - [<<~SCRIPT, src.host] - set -e -o pipefail - - tar -C #{src.path} -cf - . \$SRC_SNAP | \ - ssh #{dst.host} "mkdir -p #{dst.path} && tar -x#{tar_opt} - -C #{dst.path}" - SCRIPT end rc = clone.ssh(:cmds => script, diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 1626303d5a..3356eaf773 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -1669,12 +1669,6 @@ static int get_datastore_requirements(Template *tmpl, set& ds_ids, for (int i=0; ivector_value("TYPE") == "FILESYSTEM" ) - { - continue; - } - bool is_shareable; vatts[i]->vector_value("SHAREABLE", is_shareable); shareable = shareable || is_shareable; diff --git a/src/vm/VirtualMachineContext.cc b/src/vm/VirtualMachineContext.cc index 78edd9e6e6..d490c1ebf8 100644 --- a/src/vm/VirtualMachineContext.cc +++ b/src/vm/VirtualMachineContext.cc @@ -72,18 +72,6 @@ const std::vector NETWORK6_CONTEXT = {"EXTERNAL", "EXTERNAL", "", false}, }; -struct DiskContextVariable -{ - std::string context_name; - std::string disk_name; -}; - -const std::vector DISK_CONTEXT = -{ - {"TAG", "TARGET"}, - {"MOUNTPOINT", "MOUNTPOINT"} -}; - bool is_restricted(const string& path, const set& restricted, const set& safe) @@ -148,7 +136,6 @@ int VirtualMachine::generate_context(string &files, int &disk_id, // ------------------------------------------------------------------------- // Generate dynamic context attributes // - Network - // - Disk FS // - PCI guest address //-------------------------------------------------------------------------- int rc = generate_network_context(context, error_str, false); //no AUTO mode @@ -167,18 +154,6 @@ int VirtualMachine::generate_context(string &files, int &disk_id, return -1; } - rc = generate_disk_context(context, error_str); - - if ( rc != 0 ) - { - ostringstream oss; - - oss << "Cannot parse disk context:: " << error_str; - log("VM", Log::ERROR, oss); - - return -1; - } - vector vatts; obj_template->get("PCI", vatts); @@ -538,77 +513,6 @@ int VirtualMachine::generate_network_context(VectorAttribute* context, /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ - -static void parse_context_disk(const std::vector& cvars, - VectorAttribute * context, VectorAttribute * disk) -{ - const string& disk_id = disk->vector_value("DISK_ID"); - - if (disk_id.empty()) - { - return; - } - - for (const auto& con : cvars) - { - ostringstream cvar; - string cval; - - cvar << "DISK" << disk_id << "_" << con.context_name; - - cval = disk->vector_value(con.disk_name); - - context->replace(cvar.str(), cval); - } -} - -/* -------------------------------------------------------------------------- */ - -int VirtualMachine::generate_disk_context(VectorAttribute* context, - string& error_str) -{ - vector disks; - VectorAttribute tmp_context("TMP_CONTEXT"); - - int num = obj_template->get("DISK", disks); - - for (int i = 0; i < num; i++) - { - // TODO: use VirtualMachineDisk::skip_disk() - if ( disks[i]->vector_value("TYPE") != "FILESYSTEM" ) - { - continue; - } - - parse_context_disk(DISK_CONTEXT, &tmp_context, disks[i]); - } - - string str = tmp_context.marshall(); - - if (str.empty()) - { - return 0; - } - - string parsed; - int rc = parse_template_attribute(str, parsed, error_str); - - if (rc != 0) - { - return -1; - } - - tmp_context.clear(); - tmp_context.unmarshall(parsed); - - context->merge(&tmp_context, true); - - return 0; -} - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - static void parse_pci_context_network(const std::vector& cvars, VectorAttribute * context, const VectorAttribute * nic) { @@ -969,28 +873,5 @@ void VirtualMachine::clear_nic_alias_context(int nicid, int aliasidx) clear_context_alias_network(NETWORK6_CONTEXT, context, nicid, aliasidx); } -/* -------------------------------------------------------------------------- */ - -void VirtualMachine::clear_disk_context(int disk_id) -{ - VectorAttribute * context = obj_template->get("CONTEXT"); - - if (context == 0) - { - return; - } - - ostringstream att_name; - - for (const auto& con : DISK_CONTEXT) - { - att_name.str(""); - - att_name << "DISK" << disk_id << "_" << con.context_name; - - context->remove(att_name.str()); - } -} - /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ diff --git a/src/vm/VirtualMachineDisk.cc b/src/vm/VirtualMachineDisk.cc index d3157d3615..f7c439ac60 100644 --- a/src/vm/VirtualMachineDisk.cc +++ b/src/vm/VirtualMachineDisk.cc @@ -680,23 +680,6 @@ void VirtualMachineDisk::to_xml_short(std::ostringstream& oss) const oss << ""; } -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - -bool VirtualMachineDisk::skip_disk() const -{ - std::string type = vector_value("TYPE"); - Image::DiskType dtype = Image::str_to_disk_type(type); - - switch (dtype) - { - case Image::FILE_SYSTEM: - return true; - default: - return false; - } -} - /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -1313,14 +1296,6 @@ VirtualMachineDisk * VirtualMachineDisks::set_up_attach(int vmid, int uid, return 0; } - if ( disk->skip_disk() ) - { - error = "Can not attach disks " + disk->vector_value("TYPE"); - - delete disk; - return 0; - } - disk->set_snapshots(snap); string target = disk->vector_value("TARGET"); @@ -1734,9 +1709,7 @@ bool VirtualMachineDisks::backup_increment(bool do_volatile) one_util::toupper(type); - if ((type == "SWAP") || - ((type == "FS") && !do_volatile) || - disk->skip_disk()) + if ((type == "SWAP") || ((type == "FS") && !do_volatile)) { continue; } @@ -1782,7 +1755,6 @@ void VirtualMachineDisks::backup_disk_ids(bool do_volatile, std::vector& id if ((type == "SWAP") || (type == "CDROM") || (type == "RBD_CDROM") || - (disk->skip_disk()) || ((type == "FS") && !do_volatile)) { continue; @@ -1948,11 +1920,6 @@ int VirtualMachineDisks::check_tm_mad(const string& tm_mad, string& error) continue; } - if (disk->skip_disk()) - { - continue; - } - if ( disk->vector_value("DATASTORE_ID", ds_img_id) == 0 ) { std::string ln_target, clone_target, disk_type; diff --git a/src/vm/VirtualMachinePool.cc b/src/vm/VirtualMachinePool.cc index 2392604bfa..21db76583e 100644 --- a/src/vm/VirtualMachinePool.cc +++ b/src/vm/VirtualMachinePool.cc @@ -974,11 +974,6 @@ void VirtualMachinePool::delete_attach_disk(std::unique_ptr vm) return; } - if (disk->skip_disk()) - { - vm->clear_disk_context(disk->get_disk_id()); - } - // skip image release if there is other disk using the same image int image_id; set image_ids; diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc index f07a21274f..c940303552 100644 --- a/src/vmm/LibVirtDriverKVM.cc +++ b/src/vmm/LibVirtDriverKVM.cc @@ -1148,6 +1148,11 @@ int LibVirtDriver::deployment_description_kvm( file << numa_tune; } + if (!mbacking.empty()) + { + file << mbacking; + } + get_attribute(vm, host, cluster, "FEATURES", "IOTHREADS", iothreads); if ( iothreads > 0 ) @@ -1518,39 +1523,6 @@ int LibVirtDriver::deployment_description_kvm( << "\t\t\t\n"; } - else if ( type == "FILESYSTEM" ) - { - // SharedFS filesystem - generate XML instead of - file << "\t\t\n" - << "\t\t\t\n" - << "\t\t\t\n" - << "\t\t\t\n" - << "\t\t\n"; - - // Ensure memoryBacking with memfd and shared access for virtiofs - if (mbacking.empty()) - { - std::ostringstream mboss; - mboss << "\t\n"; - mboss << "\t\t\n"; - mboss << "\t\t\n"; - mboss << "\t\n"; - mbacking = mboss.str(); - } - else - { - // mbacking already exists (e.g., from hugepages), add virtiofs elements - // Insert before the closing tag - size_t pos = mbacking.rfind("\t\n"); - if (pos != std::string::npos) - { - mbacking.insert(pos, "\t\t\n\t\t\n"); - } - } - - // Skip the rest of disk processing for SharedFS - continue; - } else { ostringstream fname; @@ -2604,15 +2576,6 @@ int LibVirtDriver::deployment_description_kvm( file << "\t" << endl; - // ------------------------------------------------------------------------ - // Write memory backing (may have been updated by disk processing, e.g. virtiofs) - // Must be at domain level, not inside - // ------------------------------------------------------------------------ - if (!mbacking.empty()) - { - file << mbacking; - } - // ------------------------------------------------------------------------ // Features // ------------------------------------------------------------------------