mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-06 15:13:39 +09:00
F #7373: FSaaS (File System as a Service) for OpenNebula
NAME = test_ds DS_MAD = virtiofs TM_MAD = local TYPE = IMAGE_DS DISK_TYPE = FILESYSTEM oneadmin@ubuntu2204-kvm-ssh-7-0-f4a9-0:~$ cat img.txt NAME="test_fs" TYPE="FILESYSTEM" PATH="/var/tmp/sharedfs_test" PERSISTENT="YES" PERSISTENT_TYPE="SHAREABLE" DISK=[ IMAGE_ID="21" ] Notes: * Same FS image cannot be used twice in the same VirtualMachine, nor the same tag twice * OpenNebula will generate a MOUNT_POINT = /mnt/one-fs-<image_id> and a MOUNT_TAG = one-tag-<image_id>. Both can be overwritten at DISK level. * When using Hugepages in the VM that will be used for virtiofs and memory access will default to shared. Do not use MEMORY_ACCESS='private' * If not using hugepages the VM will use memfd as memoryBacking source if it includes a filesystem. * OpenNebula will map FS access (UID/GID) to a given user that can be configured per host, cluster or globally in vmm_exec_kvm.conf. By default all access is mapped to oneadmin account. * Datastore monitorization will report 0 free/used/total size. Images, representing the FS folder, reports size as the result of a du -sb command. * Most of the disk operations do not apply to filesystem disks: resize, snapshots, save-as, backup. co-authored-by: MarioRobres <mrobres@opennebula.io> co-authored-by: Marco Mancini <mmancini@opennebula.io> Signed-off-by: MarioRobres <mrobres@opennebula.io> Signed-off-by: Marco Mancini <mmancini@opennebula.io>
This commit is contained in:
33 files changed
+793
-101
No files matched your search
@@ -889,11 +889,24 @@ Request::ErrorCode VirtualMachineAPI::migrate(int vid,
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
if (live && vm->is_pinned())
|
||||
if (live)
|
||||
{
|
||||
att.resp_msg = "VM with a pinned NUMA topology cannot be live-migrated";
|
||||
if (vm->is_pinned())
|
||||
{
|
||||
att.resp_msg = "VM with a pinned NUMA topology cannot be live-migrated";
|
||||
|
||||
return Request::ACTION;
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
for (auto *disk : vm->get_disks())
|
||||
{
|
||||
if (disk->is_filesystem())
|
||||
{
|
||||
att.resp_msg = "VM with Filesytem disks cannot be live-migrated";
|
||||
|
||||
return Request::ACTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get System DS information from current History record
|
||||
@@ -1256,6 +1269,7 @@ Request::ErrorCode VirtualMachineAPI::disk_save_as(int vid,
|
||||
case Image::RAMDISK:
|
||||
case Image::CONTEXT:
|
||||
case Image::BACKUP:
|
||||
case Image::FILESYSTEM:
|
||||
goto error_image_type;
|
||||
}
|
||||
|
||||
@@ -1383,7 +1397,7 @@ error_image:
|
||||
goto error_common;
|
||||
|
||||
error_image_type:
|
||||
att.resp_msg = "Cannot save_as image of type " + Image::type_to_str(type);
|
||||
att.resp_msg = "Cannot save an image of type " + Image::type_to_str(type);
|
||||
ec = Request::INTERNAL;
|
||||
goto error_common;
|
||||
|
||||
@@ -1441,7 +1455,6 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_create(int vid,
|
||||
// Check request consistency (VM & disk exists, no volatile)
|
||||
// ------------------------------------------------------------------------
|
||||
bool img_ds_quota, vm_ds_quota;
|
||||
bool is_volatile;
|
||||
int img_id = -1;
|
||||
|
||||
if (auto vm = vmpool->get_ro(vid))
|
||||
@@ -1465,6 +1478,14 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_create(int vid,
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
if (!disk->snapshot_support())
|
||||
{
|
||||
att.resp_msg = "Cannot make snapshots on disks of type: " +
|
||||
disk->vector_value("TYPE");
|
||||
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Get disk information and quota usage deltas */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@@ -1473,13 +1494,12 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_create(int vid,
|
||||
|
||||
// Snapshot accounts as another disk of same size
|
||||
disk->resize_quotas(ssize, ds_deltas, vm_deltas, img_ds_quota, vm_ds_quota);
|
||||
|
||||
if (vm->hasHistory() && !vm_deltas.empty())
|
||||
{
|
||||
vm_deltas.add("CLUSTER_ID", vm->get_cid());
|
||||
}
|
||||
|
||||
is_volatile = disk->is_volatile();
|
||||
|
||||
disk->vector_value("IMAGE_ID", img_id);
|
||||
|
||||
vm->get_permissions(vm_perms);
|
||||
@@ -1491,13 +1511,6 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_create(int vid,
|
||||
return Request::NO_EXISTS;
|
||||
}
|
||||
|
||||
if (is_volatile)
|
||||
{
|
||||
att.resp_msg = "Cannot make snapshots on volatile disks";
|
||||
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
/* ---------- Authorization and quota update requests ---------------------- */
|
||||
att.set_auth_op(VMActions::DISK_SNAPSHOT_CREATE_ACTION);
|
||||
|
||||
@@ -1634,6 +1647,14 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_delete(int vid,
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
if (!disk->snapshot_support())
|
||||
{
|
||||
att.resp_msg = "Snapshots are not supported on disks of type: " +
|
||||
disk->vector_value("TYPE");
|
||||
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
persistent = disk->is_persistent();
|
||||
|
||||
disk->vector_value("IMAGE_ID", img_id);
|
||||
@@ -1702,6 +1723,28 @@ 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->snapshot_support())
|
||||
{
|
||||
att.resp_msg = "Snapshots are not supported on disks of type: " +
|
||||
disk->vector_value("TYPE");
|
||||
|
||||
return Request::ACTION;
|
||||
}
|
||||
}
|
||||
|
||||
// Authorize the request
|
||||
att.set_auth_op(VMActions::DISK_SNAPSHOT_REVERT_ACTION);
|
||||
|
||||
@@ -1758,6 +1801,14 @@ Request::ErrorCode VirtualMachineAPI::disk_snapshot_rename(int vid,
|
||||
return Request::ACTION;
|
||||
}
|
||||
|
||||
if (!disk->snapshot_support())
|
||||
{
|
||||
att.resp_msg = "Snapshots are not supported on disks of type: " +
|
||||
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 )
|
||||
@@ -1967,6 +2018,20 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
auto dm = Nebula::instance().get_dm();
|
||||
|
||||
int rc = dm->detach(vid, disk_id, att, att.resp_msg);
|
||||
@@ -2041,6 +2106,7 @@ Request::ErrorCode VirtualMachineAPI::disk_resize(int vid,
|
||||
|
||||
/* ------------- Get information about the disk and image --------------- */
|
||||
disk->resize_quotas(size - current_size, ds_deltas, vm_deltas, img_ds_quota, vm_ds_quota);
|
||||
|
||||
if (vm->hasHistory() && !vm_deltas.empty())
|
||||
{
|
||||
vm_deltas.add("CLUSTER_ID", vm->get_cid());
|
||||
|
||||
Reference in new issue
Block a user