Permalink
Browse files

blueprint lvm-disk-images

Add ability to use LVM volumes for VM disks.

Implements LVM disks support for libvirt driver.

VM disks will be stored on LVM volumes in volume group
 specified by `libvirt_images_volume_group` option.
 Another option `libvirt_local_images_type` specify which storage
 type will be used. Supported values are `raw`, `lvm`, `qcow2`,
 `default`. If `libvirt_local_images_type` = `default`, usual
 logic with `use_cow_images` flag is used.
Boolean option `libvirt_sparse_logical_volumes` controls which type
 of logical volumes will be created (sparsed with virtualsize or
 usual logical volumes with full space allocation). Default value
 for this option is `False`.
Commit introduce three classes: `Raw`, `Qcow2` and `Lvm`. They contain
 image creation logic, that was stored in
 `LibvirtConnection._cache_image` and `libvirt_info` methods,
 that produce right `LibvirtGuestConfigDisk` configurations for
 libvirt. `Backend` class choose which image type to use.

Change-Id: I0d01cb7d2fd67de2565b8d45d34f7846ad4112c2
  • Loading branch information...
frenzykryger committed May 16, 2012
1 parent 6555c5a commit e0540dfed1c1276106105aea8d5765356961ef3d
View
@@ -23,6 +23,7 @@ Asbjørn Sannes <asbjorn.sannes@interhost.no>
Ben McGraw <ben@pistoncloud.com>
Ben Swartzlander <bswartz@netapp.com>
Bilal Akhtar <bilalakhtar@ubuntu.com>
Boris Filippov <bfilippov@griddynamics.com>
Brad Hall <brad@nicira.com>
Brad McConnell <bmcconne@rackspace.com>
Brendan Maguire <B_Maguire@Dell.com>
View
@@ -188,4 +188,13 @@
# nova/virt/libvirt/connection.py:
filters.ReadFileFilter("/etc/iscsi/initiatorname.iscsi"),
# nova/virt/libvirt/connection.py:
filters.CommandFilter("/sbin/lvremove", "root"),
# nova/virt/libvirt/utils.py:
filters.CommandFilter("/sbin/lvcreate", "root"),
# nova/virt/libvirt/utils.py:
filters.CommandFilter("/sbin/vgs", "root")
]
@@ -0,0 +1,48 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Grid Dynamics
# All Rights Reserved.
#
# 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.
import os
from nova.virt.libvirt import config
from nova.virt.libvirt import imagebackend
class Backend(object):
def __init__(self, use_cow):
pass
def image(self, instance, name, suffix='', image_type=''):
class FakeImage(imagebackend.Image):
def __init__(self, instance, name, suffix=''):
self.path = os.path.join(instance, name + suffix)
def create_image(self, prepare_template, base,
size, *args, **kwargs):
pass
def cache(self, fn, fname, size=None, *args, **kwargs):
pass
def libvirt_info(self, device_type):
info = config.LibvirtConfigGuestDisk()
info.source_type = 'file'
info.source_device = device_type
info.driver_format = 'raw'
info.source_path = self.path
return info
return FakeImage(instance, name, suffix)
@@ -50,6 +50,22 @@ def mkfs(fs, path):
pass
def resize2fs(path):
pass
def create_lvm_image(vg, lv, size, sparse=False):
pass
def volume_group_free_space(vg):
pass
def remove_logical_volumes(*paths):
pass
def ensure_tree(path):
pass
Oops, something went wrong.

0 comments on commit e0540df

Please sign in to comment.