
Patch fixing bug #1861071 resolved the issue of extending LUKS v1 volumes when nova connects them via libvirt instead of through os-brick, but nova side still fails to extend LUKSv2 in-use volumes when they don't go through libvirt. The logs will show a very similar error, but the user won't know that this has happened and Cinder will show the new size: libvirt.libvirtError: internal error: unable to execute QEMU command 'block_resize': Cannot grow device files There are 2 parts to this problem: - The device mapper device is not automatically extended. - Nova tries to use the encrypted block device size as the size of the decrypted device. This patch adds new functionality to the encryptors so that they can extend decrypted volumes to match the size of the encrypted device. New method added to encryptors is called "extend_volume", and should be called after the homonymous method in the connector has been called, and the value returned by the encryptor's extend_volume method is the real size of the decrypted volume (encrypted volume - headers). The patch only adds functionality for LUKS and LUKSv2 volumes, not to cryptsetup volumes. Related-Bug: #1967157 Change-Id: I351f1a7769c9f915e4cd280f05a8b8b87f40df84
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
|
|
# 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.
|
|
|
|
from os_brick.encryptors import base
|
|
|
|
|
|
class NoOpEncryptor(base.VolumeEncryptor):
|
|
"""A VolumeEncryptor that does nothing.
|
|
|
|
This class exists solely to wrap regular (i.e., unencrypted) volumes so
|
|
that they do not require special handling with respect to an encrypted
|
|
volume. This implementation performs no action when a volume is attached
|
|
or detached.
|
|
"""
|
|
def __init__(self, root_helper,
|
|
connection_info,
|
|
keymgr,
|
|
execute=None,
|
|
*args, **kwargs):
|
|
super(NoOpEncryptor, self).__init__(
|
|
root_helper=root_helper,
|
|
connection_info=connection_info,
|
|
keymgr=keymgr,
|
|
execute=execute,
|
|
*args, **kwargs)
|
|
|
|
def attach_volume(self, context, **kwargs):
|
|
pass
|
|
|
|
def detach_volume(self, **kwargs):
|
|
pass
|
|
|
|
def extend_volume(self, context, **kwargs):
|
|
pass
|