Commit 77b0d264 authored by Michele Tartara's avatar Michele Tartara

Add default file_driver if missing

If the file driver of an instance with file based storage is not specified, the
default one is automatically added by the UpgradeConfig function.

Fixes Issue 571.
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 3fc1dc2f
......@@ -408,7 +408,7 @@ class LUInstanceCreate(LogicalUnit):
if (not self.op.file_driver and
self.op.disk_template in [constants.DT_FILE,
constants.DT_SHARED_FILE]):
self.op.file_driver = constants.FD_LOOP
self.op.file_driver = constants.FD_DEFAULT
if self.op.disk_template == constants.DT_FILE:
opcodes.RequireFileStorage()
......
......@@ -615,6 +615,7 @@ RBD_CMD = "rbd"
# file backend driver
FD_LOOP = "loop"
FD_BLKTAP = "blktap"
FD_DEFAULT = FD_LOOP
# the set of drbd-like disk types
LDS_DRBD = compat.UniqueFrozenset([LD_DRBD8])
......
......@@ -831,6 +831,10 @@ class Disk(ConfigObject):
self.params = {}
# add here config upgrade for this disk
# If the file driver is empty, fill it up with the default value
if self.dev_type == constants.LD_FILE and self.physical_id[0] is None:
self.physical_id[0] = constants.FD_DEFAULT
@staticmethod
def ComputeLDParams(disk_template, disk_params):
"""Computes Logical Disk parameters from Disk Template parameters.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment