2011-06-01 20:18:36 +04:00
/* -------------------------------------------------------------------------- */
2022-04-07 20:49:58 +03:00
/* Copyright 2002-2022, OpenNebula Project, OpenNebula Systems */
2011-06-01 20:18:36 +04:00
/* */
/* 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. */
/* -------------------------------------------------------------------------- */
# ifndef REQUEST_MANAGER_VIRTUAL_MACHINE_H_
2020-07-05 23:01:32 +03:00
# define REQUEST_MANAGER_VIRTUAL_MACHINE_H_
2011-06-01 20:18:36 +04:00
# include "Request.h"
# include "Nebula.h"
2019-12-10 13:45:15 +03:00
# include "VirtualMachinePool.h"
2011-06-01 20:18:36 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerVirtualMachine : public Request
{
protected :
2020-07-02 23:42:10 +03:00
RequestManagerVirtualMachine ( const std : : string & method_name ,
const std : : string & help ,
const std : : string & params )
2018-01-24 17:33:12 +03:00
: Request ( method_name , params , help )
2011-06-01 20:18:36 +04:00
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : VM ;
2017-01-30 15:19:32 +03:00
auth_op = AuthRequest : : MANAGE ;
2019-09-09 14:13:52 +03:00
}
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
~ RequestManagerVirtualMachine ( ) = default ;
2011-06-01 20:18:36 +04:00
/* -------------------------------------------------------------------- */
2011-07-07 14:45:13 +04:00
virtual void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) = 0 ;
2011-06-01 20:18:36 +04:00
2021-07-13 10:28:18 +03:00
// Authorize the request, set failure_response message
2012-10-05 15:23:44 +04:00
bool vm_authorization ( int id ,
2012-06-15 14:28:20 +04:00
ImageTemplate * tmpl ,
VirtualMachineTemplate * vtmpl ,
2012-10-05 15:23:44 +04:00
RequestAttributes & att ,
PoolObjectAuth * host_perms ,
2012-06-15 14:28:20 +04:00
PoolObjectAuth * ds_perm ,
2019-09-09 14:13:52 +03:00
PoolObjectAuth * img_perm ) ;
2011-06-01 20:18:36 +04:00
2021-07-13 10:28:18 +03:00
// Check user and group quotas. Do not set failure_response on failure
2013-10-15 15:45:16 +04:00
bool quota_resize_authorization (
Template * deltas ,
RequestAttributes & att ,
PoolObjectAuth & vm_perms ) ;
2013-08-21 15:20:09 +04:00
int get_host_information (
2020-07-02 23:42:10 +03:00
int hid ,
std : : string & name ,
std : : string & vmm ,
int & cluster_id ,
bool & is_public_cloud ,
2013-08-21 15:20:09 +04:00
PoolObjectAuth & host_perms ,
RequestAttributes & att ) ;
int get_ds_information (
int ds_id ,
2020-07-02 23:42:10 +03:00
std : : set < int > & ds_cluster_ids ,
std : : string & tm_mad ,
2015-10-29 02:57:43 +03:00
RequestAttributes & att ,
bool & ds_migr ) ;
2011-06-01 20:18:36 +04:00
2013-09-10 15:43:50 +04:00
int get_default_ds_information (
int cluster_id ,
int & ds_id ,
2020-07-02 23:42:10 +03:00
std : : string & tm_mad ,
2013-09-10 15:43:50 +04:00
RequestAttributes & att ) ;
2015-08-26 13:34:27 +03:00
bool check_host ( int hid ,
bool enforce ,
VirtualMachine * vm ,
2020-07-02 23:42:10 +03:00
std : : string & error ) ;
int add_history ( VirtualMachine * vm ,
int hid ,
int cid ,
const std : : string & hostname ,
const std : : string & vmm_mad ,
const std : : string & tm_mad ,
int ds_id ,
2011-07-07 14:45:13 +04:00
RequestAttributes & att ) ;
2011-06-01 20:18:36 +04:00
2020-09-10 10:08:29 +03:00
std : : unique_ptr < VirtualMachine > get_vm ( int id , RequestAttributes & att ) ;
2018-10-09 12:42:17 +03:00
2020-09-10 10:08:29 +03:00
std : : unique_ptr < VirtualMachine > get_vm_ro ( int id , RequestAttributes & att ) ;
2011-06-01 20:18:36 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineAction : public RequestManagerVirtualMachine
{
public :
VirtualMachineAction ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.action " ,
2011-06-01 20:18:36 +04:00
" Performs an action on a virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:ssi " ) { }
~ VirtualMachineAction ( ) = default ;
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
protected :
2011-07-07 14:45:13 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2011-06-01 20:18:36 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineDeploy : public RequestManagerVirtualMachine
{
public :
VirtualMachineDeploy ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.deploy " ,
2011-06-01 20:18:36 +04:00
" Deploys a virtual machine " ,
2018-10-09 12:42:17 +03:00
" A:siibis " )
2011-08-30 18:34:05 +04:00
{
2019-09-09 14:13:52 +03:00
vm_action = VMActions : : DEPLOY_ACTION ;
}
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDeploy ( ) = default ;
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
protected :
2011-07-07 14:45:13 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2011-06-01 20:18:36 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineMigrate : public RequestManagerVirtualMachine
{
public :
VirtualMachineMigrate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.migrate " ,
2011-06-01 20:18:36 +04:00
" Migrates a virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:siibbii " )
{
vm_action = VMActions : : MIGRATE_ACTION ;
}
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineMigrate ( ) = default ;
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
protected :
2011-07-07 14:45:13 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2011-06-01 20:18:36 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2015-06-10 20:56:35 +03:00
class VirtualMachineDiskSaveas : public RequestManagerVirtualMachine
2011-06-01 20:18:36 +04:00
{
public :
2015-06-10 20:56:35 +03:00
VirtualMachineDiskSaveas ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.disksaveas " ,
2015-06-10 20:56:35 +03:00
" Save a disk from virtual machine as a new image " ,
2019-09-09 14:13:52 +03:00
" A:siissi " )
{
vm_action = VMActions : : DISK_SAVEAS_ACTION ;
}
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDiskSaveas ( ) = default ;
2011-06-01 20:18:36 +04:00
2019-09-09 14:13:52 +03:00
protected :
2011-07-07 14:45:13 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2011-06-01 20:18:36 +04:00
} ;
2012-05-16 18:09:27 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineMonitoring : public RequestManagerVirtualMachine
{
public :
VirtualMachineMonitoring ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.monitoring " ,
2012-05-16 18:09:27 +04:00
" Returns the virtual machine monitoring records " ,
2019-09-09 14:13:52 +03:00
" A:si " )
{
auth_op = AuthRequest : : USE_NO_LCK ;
vm_action = VMActions : : MONITOR_ACTION ;
}
2012-05-16 18:09:27 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineMonitoring ( ) = default ;
2012-05-16 18:09:27 +04:00
2019-09-09 14:13:52 +03:00
protected :
2019-07-05 18:23:21 +03:00
void request_execute ( xmlrpc_c : : paramList const & paramList ,
RequestAttributes & att ) override ;
2012-05-16 18:09:27 +04:00
} ;
2012-06-13 20:57:12 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineAttach : public RequestManagerVirtualMachine
{
public :
VirtualMachineAttach ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.attach " ,
2012-06-13 20:57:12 +04:00
" Attaches a new disk to the virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:sis " )
{
vm_action = VMActions : : DISK_ATTACH_ACTION ;
}
2012-06-13 20:57:12 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineAttach ( ) = default ;
2012-06-13 20:57:12 +04:00
2018-08-29 19:08:05 +03:00
/**
* Process a DISK attahment request to a Virtual Machine
* @ param id of the VirtualMachine
* @ param tl with the new DISK description
* @ param att attributes of this request
* @ return ErroCode as defined in Request
*/
ErrorCode request_execute ( int id , VirtualMachineTemplate & tl ,
RequestAttributes & att ) ;
protected :
2012-06-13 20:57:12 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2012-06-13 20:57:12 +04:00
} ;
2012-06-14 19:45:41 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineDetach : public RequestManagerVirtualMachine
{
public :
VirtualMachineDetach ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.detach " ,
2012-06-14 19:45:41 +04:00
" Detaches a disk from a virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:sii " )
{
vm_action = VMActions : : DISK_DETACH_ACTION ;
}
2012-06-14 19:45:41 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDetach ( ) = default ;
2012-06-14 19:45:41 +04:00
2019-09-09 14:13:52 +03:00
protected :
2012-06-14 19:45:41 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2012-06-14 19:45:41 +04:00
} ;
2013-02-23 22:49:06 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2012-12-12 21:31:27 +04:00
class VirtualMachineAttachNic : public RequestManagerVirtualMachine
{
public :
VirtualMachineAttachNic ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.attachnic " ,
2012-12-12 21:31:27 +04:00
" Attaches a new NIC to the virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:sis " )
{
vm_action = VMActions : : NIC_ATTACH_ACTION ;
}
2012-12-12 21:31:27 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineAttachNic ( ) = default ;
2012-12-12 21:31:27 +04:00
2016-01-30 15:55:13 +03:00
/**
* Process a NIC attahment request to a Virtual Machine
* @ param id of the VirtualMachine
2016-04-21 17:08:28 +03:00
* @ param tl with the new NIC description
2016-01-30 15:55:13 +03:00
* @ param att attributes of this request
* @ return ErroCode as defined in Request
*/
2016-04-21 17:08:28 +03:00
ErrorCode request_execute ( int id , VirtualMachineTemplate & tl ,
RequestAttributes & att ) ;
protected :
2019-07-05 18:23:21 +03:00
void request_execute ( xmlrpc_c : : paramList const & pl ,
RequestAttributes & ra ) override ;
2012-12-12 21:31:27 +04:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class VirtualMachineDetachNic : public RequestManagerVirtualMachine
{
public :
VirtualMachineDetachNic ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.detachnic " ,
2012-12-12 21:31:27 +04:00
" Detaches a NIC from a virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:sii " )
{
vm_action = VMActions : : NIC_DETACH_ACTION ;
}
2012-12-12 21:31:27 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDetachNic ( ) = default ;
2012-12-12 21:31:27 +04:00
2016-01-30 15:55:13 +03:00
/**
* Process a NIC detach request to a Virtual Machine
* @ param id of the VirtualMachine
* @ param nic_id id of the NIC
* @ param att attributes of this request
* @ return ErroCode as defined in Request
*/
2016-04-21 17:08:28 +03:00
ErrorCode request_execute ( int id , int nic_id , RequestAttributes & att ) ;
protected :
2019-07-05 18:23:21 +03:00
void request_execute ( xmlrpc_c : : paramList const & pl ,
RequestAttributes & ra ) override ;
2012-12-12 21:31:27 +04:00
} ;
2011-06-01 20:18:36 +04:00
/* -------------------------------------------------------------------------- */
2013-03-06 18:59:58 +04:00
/* -------------------------------------------------------------------------- */
2013-02-23 22:49:06 +04:00
class VirtualMachineResize : public RequestManagerVirtualMachine
{
public :
VirtualMachineResize ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.resize " ,
2013-02-23 22:49:06 +04:00
" Changes the capacity of the virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:sisb " )
{
vm_action = VMActions : : RESIZE_ACTION ;
}
2017-01-30 15:19:32 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineResize ( ) = default ;
2013-02-23 22:49:06 +04:00
2019-09-09 14:13:52 +03:00
protected :
2013-02-23 22:49:06 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2013-02-23 22:49:06 +04:00
} ;
2013-02-28 06:19:04 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2013-02-19 18:21:33 +04:00
class VirtualMachineSnapshotCreate : public RequestManagerVirtualMachine
{
public :
VirtualMachineSnapshotCreate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.snapshotcreate " ,
2013-02-19 18:21:33 +04:00
" Creates a new virtual machine snapshot " ,
2019-09-09 14:13:52 +03:00
" A:sis " )
{
vm_action = VMActions : : SNAPSHOT_CREATE_ACTION ;
}
2013-02-19 18:21:33 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineSnapshotCreate ( ) = default ;
2013-02-19 18:21:33 +04:00
2019-09-09 14:13:52 +03:00
protected :
2013-02-19 18:21:33 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2013-02-19 18:21:33 +04:00
} ;
2013-02-20 19:04:09 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineSnapshotRevert : public RequestManagerVirtualMachine
{
public :
VirtualMachineSnapshotRevert ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.snapshotrevert " ,
2013-02-20 19:04:09 +04:00
" Reverts a virtual machine to a snapshot " ,
2019-09-09 14:13:52 +03:00
" A:sii " )
{
vm_action = VMActions : : SNAPSHOT_REVERT_ACTION ;
}
2013-02-20 19:04:09 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineSnapshotRevert ( ) = default ;
2013-02-20 19:04:09 +04:00
2019-09-09 14:13:52 +03:00
protected :
2013-02-20 19:04:09 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2013-02-20 19:04:09 +04:00
} ;
2013-02-21 18:01:48 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineSnapshotDelete : public RequestManagerVirtualMachine
{
public :
VirtualMachineSnapshotDelete ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.snapshotdelete " ,
2013-02-21 18:21:31 +04:00
" Deletes a virtual machine snapshot " ,
2019-09-09 14:13:52 +03:00
" A:sii " )
{
vm_action = VMActions : : SNAPSHOT_DELETE_ACTION ;
}
2013-02-21 18:01:48 +04:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineSnapshotDelete ( ) = default ;
2013-02-21 18:01:48 +04:00
2019-09-09 14:13:52 +03:00
protected :
2013-02-21 18:01:48 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2013-02-21 18:01:48 +04:00
} ;
2013-05-17 02:45:38 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineRecover : public RequestManagerVirtualMachine
{
public :
VirtualMachineRecover ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.recover " ,
2013-05-17 02:45:38 +04:00
" Recovers a virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:sii " )
{
vm_action = VMActions : : RECOVER_ACTION ;
}
~ VirtualMachineRecover ( ) = default ;
2013-05-17 02:45:38 +04:00
2019-09-09 14:13:52 +03:00
protected :
2013-05-17 02:45:38 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2013-05-17 02:45:38 +04:00
} ;
2011-06-01 20:18:36 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2014-11-04 20:46:14 +03:00
class VirtualMachinePoolCalculateShowback : public RequestManagerVirtualMachine
{
public :
VirtualMachinePoolCalculateShowback ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vmpool.calculateshowback " ,
2017-01-30 15:19:32 +03:00
" Processes all the history records, and stores the monthly cost "
" for each VM " , " A:sii " )
2014-11-04 20:46:14 +03:00
{
auth_object = PoolObjectSQL : : VM ;
2019-09-09 14:13:52 +03:00
}
2014-11-04 20:46:14 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachinePoolCalculateShowback ( ) = default ;
2014-11-04 20:46:14 +03:00
2019-09-09 14:13:52 +03:00
protected :
2019-07-05 18:23:21 +03:00
void request_execute ( xmlrpc_c : : paramList const & paramList ,
RequestAttributes & att ) override ;
2014-11-04 20:46:14 +03:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2015-05-19 19:41:23 +03:00
class VirtualMachineDiskSnapshotCreate : public RequestManagerVirtualMachine
{
public :
VirtualMachineDiskSnapshotCreate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.disksnapshotcreate " ,
2015-05-19 19:41:23 +03:00
" Creates a new virtual machine disk snapshot " ,
2019-09-09 14:13:52 +03:00
" A:siis " )
{
2015-07-17 19:31:38 +03:00
Nebula & nd = Nebula : : instance ( ) ;
ipool = nd . get_ipool ( ) ;
2017-01-30 15:19:32 +03:00
2019-09-09 14:13:52 +03:00
vm_action = VMActions : : DISK_SNAPSHOT_CREATE_ACTION ;
}
2015-05-19 19:41:23 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDiskSnapshotCreate ( ) = default ;
2015-05-19 19:41:23 +03:00
2019-09-09 14:13:52 +03:00
protected :
2015-05-19 19:41:23 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-07-17 19:31:38 +03:00
private :
ImagePool * ipool ;
2015-05-19 19:41:23 +03:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class VirtualMachineDiskSnapshotRevert : public RequestManagerVirtualMachine
{
public :
VirtualMachineDiskSnapshotRevert ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.disksnapshotrevert " ,
2015-05-19 19:41:23 +03:00
" Reverts disk state to a snapshot " ,
2019-09-09 14:13:52 +03:00
" A:siii " )
{
vm_action = VMActions : : DISK_SNAPSHOT_REVERT_ACTION ;
}
2015-05-19 19:41:23 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDiskSnapshotRevert ( ) = default ;
2015-05-19 19:41:23 +03:00
2019-09-09 14:13:52 +03:00
protected :
2015-05-19 19:41:23 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-05-19 19:41:23 +03:00
} ;
2015-05-27 17:29:41 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class VirtualMachineDiskSnapshotDelete : public RequestManagerVirtualMachine
{
public :
VirtualMachineDiskSnapshotDelete ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.disksnapshotdelete " ,
2015-05-27 17:29:41 +03:00
" Deletes a disk snapshot " ,
2019-09-09 14:13:52 +03:00
" A:siii " )
{
2015-07-17 19:31:38 +03:00
Nebula & nd = Nebula : : instance ( ) ;
ipool = nd . get_ipool ( ) ;
2017-01-30 15:19:32 +03:00
2019-09-09 14:13:52 +03:00
vm_action = VMActions : : DISK_SNAPSHOT_DELETE_ACTION ;
}
2015-05-27 17:29:41 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDiskSnapshotDelete ( ) = default ;
2015-05-27 17:29:41 +03:00
2019-09-09 14:13:52 +03:00
protected :
2015-05-27 17:29:41 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-07-17 19:31:38 +03:00
private :
ImagePool * ipool ;
2015-05-27 17:29:41 +03:00
} ;
2016-04-20 17:57:05 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2018-10-11 18:01:36 +03:00
class VirtualMachineDiskSnapshotRename : public RequestManagerVirtualMachine
{
public :
VirtualMachineDiskSnapshotRename ( ) :
RequestManagerVirtualMachine ( " one.vm.disksnapshotrename " ,
" Rename a disk snapshot " ,
2019-12-10 13:45:15 +03:00
" A:siiis " )
2019-09-09 14:13:52 +03:00
{
vm_action = VMActions : : DISK_SNAPSHOT_RENAME_ACTION ;
}
2018-10-11 18:01:36 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDiskSnapshotRename ( ) = default ;
2018-10-11 18:01:36 +03:00
2019-09-09 14:13:52 +03:00
protected :
2018-10-11 18:01:36 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2018-10-11 18:01:36 +03:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2016-04-20 17:57:05 +03:00
class VirtualMachineUpdateConf : public RequestManagerVirtualMachine
{
public :
VirtualMachineUpdateConf ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.updateconf " ,
2016-04-20 17:57:05 +03:00
" Updates several configuration attributes of a VM " ,
2019-09-09 14:13:52 +03:00
" A:sis " )
{
vm_action = VMActions : : UPDATECONF_ACTION ;
}
2016-04-20 17:57:05 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineUpdateConf ( ) = default ;
2016-04-20 17:57:05 +03:00
2019-09-09 14:13:52 +03:00
protected :
2016-04-20 17:57:05 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2016-04-20 17:57:05 +03:00
} ;
2019-09-09 14:13:52 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2016-12-15 23:12:33 +03:00
class VirtualMachineDiskResize : public RequestManagerVirtualMachine
{
public :
VirtualMachineDiskResize ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerVirtualMachine ( " one.vm.diskresize " ,
2016-12-15 23:12:33 +03:00
" Resizes a disk from a virtual machine " ,
2019-09-09 14:13:52 +03:00
" A:siis " )
{
2017-01-30 15:19:32 +03:00
Nebula & nd = Nebula : : instance ( ) ;
ipool = nd . get_ipool ( ) ;
2019-09-09 14:13:52 +03:00
vm_action = VMActions : : DISK_RESIZE_ACTION ;
}
2016-12-15 23:12:33 +03:00
2019-09-09 14:13:52 +03:00
~ VirtualMachineDiskResize ( ) = default ;
2016-12-15 23:12:33 +03:00
2019-09-09 14:13:52 +03:00
protected :
2016-12-15 23:12:33 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2019-09-09 14:13:52 +03:00
2016-12-15 23:12:33 +03:00
private :
ImagePool * ipool ;
} ;
2022-01-25 20:02:10 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineAttachSG : public RequestManagerVirtualMachine
{
public :
VirtualMachineAttachSG ( ) :
RequestManagerVirtualMachine ( " one.vm.attachsg " ,
" Attaches a SG to the virtual machine NIC " ,
" A:siii " )
{
}
protected :
void request_execute ( xmlrpc_c : : paramList const & pl ,
RequestAttributes & ra ) override ;
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class VirtualMachineDetachSG : public RequestManagerVirtualMachine
{
public :
VirtualMachineDetachSG ( ) :
RequestManagerVirtualMachine ( " one.vm.detachsg " ,
" Detaches a SG form virtual machine NIC " ,
" A:siii " )
{
}
protected :
void request_execute ( xmlrpc_c : : paramList const & pl ,
RequestAttributes & ra ) override ;
} ;
2011-06-01 20:18:36 +04:00
# endif