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", MOUNTPOINT="/mnt", TARGET="disk0_tag" ] 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:
31 files changed
+582
-48
No files matched your search
@@ -1249,6 +1249,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;
|
||||
}
|
||||
|
||||
@@ -1458,6 +1459,14 @@ 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 */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@@ -1627,6 +1636,14 @@ 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);
|
||||
@@ -1695,6 +1712,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->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);
|
||||
|
||||
@@ -1751,6 +1790,14 @@ 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 )
|
||||
@@ -1960,6 +2007,27 @@ 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);
|
||||
|
||||
Reference in new issue
Block a user