2010-10-01 19:12:13 +04:00
/* -------------------------------------------------------------------------- */
2024-07-29 15:25:20 +03:00
/* Copyright 2002-2024, OpenNebula Project, OpenNebula Systems */
2010-10-01 19:12:13 +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. */
/* -------------------------------------------------------------------------- */
2009-01-26 21:25:15 +03:00
2008-07-04 20:55:49 +04:00
# ifndef LIBVIRT_DRIVER_H_
# define LIBVIRT_DRIVER_H_
# include <map>
# include <string>
# include "VirtualMachineManagerDriver.h"
class LibVirtDriver : public VirtualMachineManagerDriver
{
public :
2020-06-29 13:14:00 +03:00
LibVirtDriver ( const std : : string & mad_location ,
const std : : map < std : : string , std : : string > & attrs ,
const std : : string & emu )
: VirtualMachineManagerDriver ( mad_location , attrs ) , emulator ( emu )
{ }
2008-07-04 20:55:49 +04:00
2020-06-29 13:14:00 +03:00
~ LibVirtDriver ( ) = default ;
2008-07-04 20:55:49 +04:00
2020-06-29 13:14:00 +03:00
int validate_raw ( const std : : string & raw_section ,
std : : string & error ) const override ;
2020-05-18 03:23:29 +03:00
2021-09-14 16:26:21 +03:00
/**
* Validates driver specific attributes in VM Template
* @ param tmpl Virtual Machine Template
* @ param error description on error
* @ return 0 on success
*/
int validate_template ( const VirtualMachine * vm , int hid , int cluster_id ,
std : : string & error ) const override ;
2008-07-04 20:55:49 +04:00
private :
2023-06-02 14:49:48 +03:00
static const int CEPH_DEFAULT_PORT ;
2013-05-18 22:22:47 +04:00
2023-06-02 14:49:48 +03:00
static const int GLUSTER_DEFAULT_PORT ;
2013-05-18 22:22:47 +04:00
2023-06-02 14:49:48 +03:00
static const int ISCSI_DEFAULT_PORT ;
static const int Q35_ROOT_DEFAULT_PORTS ;
2014-12-11 15:17:52 +03:00
2020-05-18 03:23:29 +03:00
static const char * XML_DOMAIN_RNG_PATH ;
2014-12-11 15:17:52 +03:00
2020-06-29 13:14:00 +03:00
int deployment_description ( const VirtualMachine * vm ,
const std : : string & fn ) const override
2010-10-01 19:12:13 +04:00
{
int rc = - 1 ;
2013-05-18 22:22:47 +04:00
if ( emulator = = " kvm " | | emulator = = " qemu " )
2010-10-01 19:12:13 +04:00
{
2016-04-07 12:06:43 +03:00
rc = deployment_description_kvm ( vm , fn ) ;
2010-10-01 19:12:13 +04:00
}
return rc ;
}
2020-06-29 13:14:00 +03:00
int deployment_description_kvm ( const VirtualMachine * v ,
const std : : string & f ) const ;
2010-10-01 19:12:13 +04:00
2020-06-29 13:14:00 +03:00
const std : : string emulator ;
2008-07-04 20:55:49 +04:00
} ;
# endif /*LIBVIRT_DRIVER_H_*/