Beispiel #1
0
Datei: vm.py Projekt: bellle/lago
import libvirt
from lxml import etree as ET
from textwrap import dedent

from lago import export, log_utils, sysprep, utils
from lago.utils import LagoException
from lago.config import config
from lago.plugins import vm as vm_plugin
from lago.plugins.vm import ExtractPathError
from lago.providers.libvirt import utils as libvirt_utils
from lago.providers.libvirt import cpu
from lago.validation import check_import

LOGGER = logging.getLogger(__name__)

if check_import('guestfs'):
    from lago import guestfs_tools
else:
    LOGGER.debug('guestfs not available')

LogTask = functools.partial(log_utils.LogTask, logger=LOGGER)
log_task = functools.partial(log_utils.log_task, logger=LOGGER)


class LocalLibvirtVMProvider(vm_plugin.VMProviderPlugin):
    def __init__(self, vm):
        super().__init__(vm)
        self._has_guestfs = 'lago.guestfs_tools' in sys.modules
        self.libvirt_con = libvirt_utils.get_libvirt_connection(
            name=self.vm.virt_env.uuid, )
        self._caps = None
Beispiel #2
0
Datei: vm.py Projekt: nirs/lago
import libvirt
from lxml import etree as ET
from textwrap import dedent

from lago import export, log_utils, sysprep, utils
from lago.utils import LagoException
from lago.config import config
from lago.plugins import vm as vm_plugin
from lago.plugins.vm import ExtractPathError
from lago.providers.libvirt import utils as libvirt_utils
from lago.providers.libvirt import cpu
from lago.validation import check_import

LOGGER = logging.getLogger(__name__)

if check_import('guestfs'):
    from lago import guestfs_tools
else:
    LOGGER.debug('guestfs not available')

LogTask = functools.partial(log_utils.LogTask, logger=LOGGER)
log_task = functools.partial(log_utils.log_task, logger=LOGGER)


class LocalLibvirtVMProvider(vm_plugin.VMProviderPlugin):
    def __init__(self, vm):
        super().__init__(vm)
        self._has_guestfs = 'lago.guestfs_tools' in sys.modules
        self.libvirt_con = libvirt_utils.get_libvirt_connection(
            name=self.vm.virt_env.uuid,
        )
Beispiel #3
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
#
# Refer to the README and COPYING files for full details of the license
#
import logging
from textwrap import dedent
from lago.validation import check_import

LOGGER = logging.getLogger(__name__)
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING)
LOGGER.addHandler(ch)

if not check_import('guestfs'):
    pip_link = 'http://libguestfs.org/download/python/guestfs-1.XX.YY.tar.gz'

    msg = dedent("""
            WARNING: - guestfs not found. Some Lago features will not work.
            Please install it either by using your distribution package, or
            with pip.

            For Fedora/CentOS, run: yum install python2-libguestfs

            For Debian, run: apt-get install python-libguestfs

            For pip, go to http://libguestfs.org/download/python, pick
            the version and run:

            pip install {pip_link}
Beispiel #4
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
#
# Refer to the README and COPYING files for full details of the license
#
import logging
from textwrap import dedent
from lago.validation import check_import

LOGGER = logging.getLogger(__name__)
ch = logging.StreamHandler()
ch.setLevel(logging.WARNING)
LOGGER.addHandler(ch)

if not check_import('guestfs'):
    pip_link = 'http://libguestfs.org/download/python/guestfs-1.XX.YY.tar.gz'

    msg = dedent(
        """
            WARNING: - guestfs not found. Some Lago features will not work.
            Please install it either by using your distribution package, or
            with pip.

            For Fedora/CentOS, run: yum install python2-libguestfs

            For Debian, run: apt-get install python-libguestfs

            For pip, go to http://libguestfs.org/download/python, pick
            the version and run: