2010-10-01 19:12:13 +04:00
/* -------------------------------------------------------------------------- */
2013-01-24 19:18:30 +04:00
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
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 <sstream>
# include "VirtualMachineManagerDriver.h"
class LibVirtDriver : public VirtualMachineManagerDriver
{
public :
LibVirtDriver (
int userid ,
const map < string , string > & attrs ,
bool sudo ,
VirtualMachinePool * pool ,
const string _emulator ) :
VirtualMachineManagerDriver ( userid , attrs , sudo , pool ) ,
emulator ( _emulator )
{ } ;
~ LibVirtDriver ( ) { } ;
private :
2012-01-11 15:46:49 +04:00
static const char * vmware_vnm_name ;
2013-05-18 22:22:47 +04:00
2012-07-19 04:22:06 +04:00
static const float CGROUP_BASE_CPU_SHARES ;
2013-05-18 22:22:47 +04:00
2008-07-04 20:55:49 +04:00
int deployment_description (
2010-10-01 19:12:13 +04:00
const VirtualMachine * vm ,
const string & file_name ) const
{
int rc = - 1 ;
2013-05-18 22:22:47 +04:00
if ( emulator = = " kvm " | | emulator = = " qemu " )
2010-10-01 19:12:13 +04:00
{
rc = deployment_description_kvm ( vm , file_name ) ;
}
else if ( emulator = = " vmware " )
{
rc = deployment_description_vmware ( vm , file_name ) ;
}
return rc ;
}
2010-09-30 19:08:32 +04:00
int deployment_description_kvm (
2010-10-01 19:12:13 +04:00
const VirtualMachine * vm ,
2010-09-30 19:08:32 +04:00
const string & file_name ) const ;
2010-10-01 19:12:13 +04:00
2010-09-30 19:08:32 +04:00
int deployment_description_vmware (
2010-10-01 19:12:13 +04:00
const VirtualMachine * vm ,
2010-09-30 19:08:32 +04:00
const string & file_name ) const ;
2010-10-01 19:12:13 +04:00
2008-07-04 20:55:49 +04:00
const string emulator ;
} ;
# endif /*LIBVIRT_DRIVER_H_*/