Ramesh N has uploaded a new change for review.

Change subject: engine: BLL command for gluster brick creation
......................................................................

engine: BLL command for gluster brick creation

 BLL Command for gluster brick creation.

Change-Id: I23fa314118324ca3f441d43852b8c57c54245308
Signed-off-by: Ramesh Nachimuthu <[email protected]>
---
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java
A 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommandTest.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateBrickParameters.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/RaidType.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/locks/LockingGroup.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
M 
backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
15 files changed, 471 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/40041/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java
new file mode 100644
index 0000000..0846e22
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommand.java
@@ -0,0 +1,154 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.ovirt.engine.core.bll.LockMessagesMatchUtil;
+import org.ovirt.engine.core.bll.VdsCommand;
+import org.ovirt.engine.core.bll.VdsValidator;
+import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.action.LockProperties;
+import org.ovirt.engine.core.common.action.LockProperties.Scope;
+import org.ovirt.engine.core.common.action.gluster.CreateBrickParameters;
+import org.ovirt.engine.core.common.businessentities.RaidType;
+import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
+import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice;
+import org.ovirt.engine.core.common.constants.gluster.GlusterConstants;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.gluster.GlusterFeatureSupported;
+import org.ovirt.engine.core.common.locks.LockingGroup;
+import org.ovirt.engine.core.common.utils.ObjectUtils;
+import org.ovirt.engine.core.common.utils.Pair;
+import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
+import 
org.ovirt.engine.core.common.vdscommands.gluster.CreateBrickVDSParameters;
+import org.ovirt.engine.core.dal.dbbroker.DbFacade;
+
+public class CreateBrickCommand extends VdsCommand<CreateBrickParameters> {
+
+    public CreateBrickCommand(CreateBrickParameters parameters) {
+        super(parameters);
+    }
+
+    @Override
+    protected void setActionMessageParameters() {
+        addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE);
+        addCanDoActionMessage(VdcBllMessages.VAR__TYPE__GLUSTER_BRICK);
+        addCanDoActionMessageVariable("brickName", 
getParameters().getLvName());
+    }
+
+    @Override
+    public Map<String, String> getCustomValues() {
+        addCustomValue(GlusterConstants.BRICK_NAME, 
getParameters().getLvName());
+        return super.getCustomValues();
+    }
+
+    @Override
+    protected boolean canDoAction() {
+        VDSGroup cluster = getVdsGroup();
+        if (!cluster.supportsGlusterService()
+                || 
!GlusterFeatureSupported.glusterBrickProvisioning(cluster.getcompatibility_version()))
 {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_PROVISIONING_NOT_SUPPORTED_BY_CLUSTER);
+        }
+
+        VdsValidator validator = new VdsValidator(getVds());
+        if (!validate(validator.isUp())) {
+            return false;
+        }
+
+        String deviceType;
+        if (getParameters().getDisks().isEmpty()) {
+            
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DEVICE_REQUIRED);
+            return false;
+        } else {
+            deviceType = getParameters().getDisks().get(0).getDevType();
+        }
+
+        for (StorageDevice device : getParameters().getDisks()) {
+            // Check that all the selected devices are of same type. Mixing 
device types in Brick creation is not
+            // allowed
+            // for performance reasons.
+            if (!ObjectUtils.objectsEqual(deviceType, device.getDevType())) {
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DIFFERENT_STORAGE_DEVICE_TYPES_SELECTED);
+                return false;
+            }
+
+            // Ensure that device is not already used by some other brick or 
LVM.
+            if (!device.getCanCreateBrick()) {
+                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_DEVICE_IS_ALREADY_IN_USE);
+                addCanDoActionMessageVariable("storageDevice", 
device.getName());
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    protected void executeCommand() {
+
+        Map<String, Object> raidParams = new HashMap<>();
+        if (!getParameters().getRaidType().equals(RaidType.None)
+                && !getParameters().getRaidType().equals(RaidType.Raid0)) {
+            raidParams.put("type", getParameters().getRaidType().getValue()); 
//$NON-NLS-1$
+            raidParams.put("pdCount", 
getParameters().getNoOfPhysicalDisksInRaidVolume()); //$NON-NLS-1$
+            raidParams.put("stripSize", getParameters().getStripeSize()); 
//$NON-NLS-1$
+        }
+
+        VDSReturnValue returnValue = runVdsCommand(
+                VDSCommandType.CreateBrick,
+                new CreateBrickVDSParameters(getVdsId(),
+                        getParameters().getLvName(),
+                        getParameters().getMountPoint(),
+                        raidParams,
+                        GlusterConstants.FS_TYPE_XFS,
+                        getParameters().getDisks()));
+        setSucceeded(returnValue.getSucceeded());
+        if (getSucceeded()) {
+            StorageDevice storageDevice = (StorageDevice) 
returnValue.getReturnValue();
+            saveStoageDevice(storageDevice);
+            // Reset the isFree flag on all the devices which are used for 
brick creation
+            resetIsFreeFlag(getParameters().getDisks());
+        } else {
+            handleVdsError(returnValue);
+        }
+    }
+
+    private void resetIsFreeFlag(List<StorageDevice> devices) {
+        for (StorageDevice device : devices) {
+            
DbFacade.getInstance().getStorageDeviceDao().updateIsFreeFlag(device.getId(), 
false);
+        }
+    }
+
+    private void saveStoageDevice(StorageDevice storageDevice) {
+        DbFacade.getInstance().getStorageDeviceDao().save(storageDevice);
+    }
+
+    @Override
+    protected VDS getVds() {
+        return super.getVds();
+    }
+
+    @Override
+    protected Map<String, Pair<String, String>> getExclusiveLocks() {
+        Map<String, Pair<String, String>> locksMap = new HashMap<>();
+        for (StorageDevice disk : getParameters().getDisks()) {
+            locksMap.put(disk.getId().toString(),
+                    
LockMessagesMatchUtil.makeLockingPair(LockingGroup.HOST_STORAGE_DEVICES,
+                            
VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DEVICE_LOCKED));
+        }
+        return locksMap;
+    }
+
+    @Override
+    protected LockProperties applyLockProperties(LockProperties 
lockProperties) {
+        return lockProperties.withScope(Scope.Execution).withWait(false);
+    }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        return getSucceeded() ? AuditLogType.CREATE_GLUSTER_BRICK : 
AuditLogType.CREATE_GLUSTER_BRICK_FAILED;
+    }
+}
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommandTest.java
new file mode 100644
index 0000000..afcd327
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateBrickCommandTest.java
@@ -0,0 +1,162 @@
+package org.ovirt.engine.core.bll.gluster;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+import static org.ovirt.engine.core.utils.MockConfigRule.mockConfig;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.ovirt.engine.core.common.action.gluster.CreateBrickParameters;
+import org.ovirt.engine.core.common.businessentities.RaidType;
+import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
+import org.ovirt.engine.core.common.businessentities.VDSStatus;
+import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice;
+import org.ovirt.engine.core.common.config.ConfigValues;
+import org.ovirt.engine.core.compat.Guid;
+import org.ovirt.engine.core.compat.Version;
+import org.ovirt.engine.core.utils.MockConfigRule;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CreateBrickCommandTest {
+
+    private final Guid CLUSTER_ID = new 
Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+    private final Guid HOST_ID = new 
Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+
+    @Mock
+    private VDS vds;
+
+    @Mock
+    private VDSGroup vdsGroup;
+
+    /**
+     * The command under test.
+     */
+    private CreateBrickCommand cmd;
+
+    @ClassRule
+    public static MockConfigRule mcr = new MockConfigRule(
+            mockConfig(ConfigValues.GlusterBrickProvisioningEnabled, 
Version.v3_5.toString(), true),
+            mockConfig(ConfigValues.GlusterBrickProvisioningEnabled, 
Version.v3_4.toString(), false)
+            );
+
+    @Test
+    public void canDoActionSucceeds() {
+        cmd = spy(new CreateBrickCommand(new CreateBrickParameters(HOST_ID,
+                "brick1",
+                "/gluster-bricks/brick1",
+                RaidType.Raid0,
+                null,
+                null, Arrays.asList(getStorageDevice("sda", null)))));
+        prepareMocks(cmd, VDSStatus.Up);
+        assertTrue(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsForCluster() {
+        cmd = spy(new CreateBrickCommand(new CreateBrickParameters()));
+        prepareMocks(cmd, VDSStatus.Up);
+        mockIsGlusterEnabled(false);
+        assertFalse(cmd.canDoAction());
+
+        mockIsGlusterEnabled(true);
+        mockCompatibilityVersion(Version.v3_5);
+        assertFalse(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsForVdsNonUp() {
+        cmd = spy(new CreateBrickCommand(new CreateBrickParameters()));
+        prepareMocks(cmd, VDSStatus.Down);
+        assertFalse(cmd.canDoAction());
+
+        doReturn(VDSStatus.Error).when(vds).getStatus();
+        assertFalse(cmd.canDoAction());
+
+        doReturn(VDSStatus.Maintenance).when(vds).getStatus();
+        assertFalse(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsForNoStorageDevice() {
+        cmd = spy(new CreateBrickCommand(new CreateBrickParameters(HOST_ID,
+                "brick1",
+                "/gluster-bricks/brick1",
+                RaidType.Raid0,
+                null,
+                null, Collections.EMPTY_LIST)));
+        prepareMocks(cmd, VDSStatus.Up);
+        assertFalse(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsForDeviceAlreadyInUse() {
+        StorageDevice storageDevice = getStorageDevice("sda", null);
+        storageDevice.setCanCreateBrick(false);
+        cmd = spy(new CreateBrickCommand(new CreateBrickParameters(HOST_ID,
+                "brick1",
+                "/gluster-bricks/brick1",
+                RaidType.Raid0,
+                null,
+                null, Arrays.asList(storageDevice))));
+        prepareMocks(cmd, VDSStatus.Up);
+        assertFalse(cmd.canDoAction());
+    }
+
+    @Test
+    public void canDoActionFailsForDifferentStorageDevice() {
+        StorageDevice storageDevice1 = getStorageDevice("sda", null);
+        StorageDevice storageDevice2 = getStorageDevice("sdb", null);
+        storageDevice2.setDevType("SDA");
+
+        cmd = spy(new CreateBrickCommand(new CreateBrickParameters(HOST_ID,
+                "brick1",
+                "/gluster-bricks/brick1",
+                RaidType.Raid0,
+                null,
+                null, Arrays.asList(storageDevice1, storageDevice2))));
+        prepareMocks(cmd, VDSStatus.Up);
+        assertFalse(cmd.canDoAction());
+    }
+
+    protected <T extends CreateBrickCommand> void prepareMocks(T command, 
VDSStatus status) {
+        when(command.getVdsGroup()).thenReturn(vdsGroup);
+        doReturn(vds).when(command).getVds();
+        doReturn(status).when(vds).getStatus();
+        mockIsGlusterEnabled(true);
+        mockCompatibilityVersion(Version.v3_5);
+    }
+
+    private void mockIsGlusterEnabled(boolean glusterService) {
+        when(vdsGroup.supportsGlusterService()).thenReturn(glusterService);
+    }
+
+    private void mockCompatibilityVersion(Version version) {
+        when(vdsGroup.getcompatibility_version()).thenReturn(version);
+    }
+
+    private StorageDevice getStorageDevice(String name, Guid id) {
+        StorageDevice storageDevice = new StorageDevice();
+        storageDevice.setCanCreateBrick(true);
+        storageDevice.setDescription("Test Device" + name);
+        storageDevice.setDevPath("/dev/" + name);
+        storageDevice.setDevType("SCSI");
+        storageDevice.setName(name);
+        storageDevice.setSize(10000L);
+        if (id == null) {
+            storageDevice.setId(Guid.newGuid());
+        } else {
+            storageDevice.setId(id);
+        }
+        return storageDevice;
+    }
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index 86e1d26..e7ae7c8 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -429,6 +429,8 @@
     GLUSTER_VOLUME_SNAPSHOT_SCHEDULE_FAILED(4135, AuditLogSeverity.ERROR),
     GLUSTER_VOLUME_SNAPSHOT_RESCHEDULED(4136),
     GLUSTER_VOLUME_SNAPSHOT_RESCHEDULE_FAILED(4137, AuditLogSeverity.ERROR),
+    CREATE_GLUSTER_BRICK(4138),
+    CREATE_GLUSTER_BRICK_FAILED(4139),
 
     USER_FORCE_SELECTED_SPM(159),
     USER_VDS_RESTART(41),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
index df64fff..f9c9cb6 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java
@@ -322,6 +322,7 @@
     CreateGlusterVolumeSnapshot(1441, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
     ScheduleGlusterVolumeSnapshot(1442, ActionGroup.MANIPULATE_GLUSTER_VOLUME, 
QuotaDependency.NONE),
     RescheduleGlusterVolumeSnapshot(1443, 
ActionGroup.MANIPULATE_GLUSTER_VOLUME, QuotaDependency.NONE),
+    CreateBrick(1444, ActionGroup.MANIPULATE_HOST, QuotaDependency.NONE),
 
     // Cluster Policy
     AddClusterPolicy(1450, ActionGroup.EDIT_STORAGE_POOL_CONFIGURATION, false, 
QuotaDependency.NONE),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateBrickParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateBrickParameters.java
new file mode 100644
index 0000000..47c349d
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/gluster/CreateBrickParameters.java
@@ -0,0 +1,94 @@
+package org.ovirt.engine.core.common.action.gluster;
+
+import java.util.List;
+
+import org.ovirt.engine.core.common.action.VdsActionParameters;
+import org.ovirt.engine.core.common.businessentities.RaidType;
+import org.ovirt.engine.core.common.businessentities.gluster.StorageDevice;
+import org.ovirt.engine.core.compat.Guid;
+
+/**
+ * Command parameters for the "Create Volume" action
+ */
+public class CreateBrickParameters extends VdsActionParameters {
+
+    private static final long serialVersionUID = 761203751697100144L;
+
+    private String lvName;
+
+    private List<StorageDevice> disks;
+    private String mountPoint;
+    private RaidType raidType;
+    private Integer noOfPhysicalDisksInRaidVolume;
+    private Integer stripeSize;
+
+    public CreateBrickParameters() {
+
+    }
+
+    public CreateBrickParameters(Guid hostId,
+            String lvName,
+            String mountPoint,
+            RaidType raidType,
+            Integer noOfPhysicalDisksInRaidVolume,
+            Integer stripeSize,
+            List<StorageDevice> selectedDevices) {
+        super(hostId);
+        this.lvName = lvName;
+        this.mountPoint = mountPoint;
+        this.disks = selectedDevices;
+        this.raidType = raidType;
+        this.noOfPhysicalDisksInRaidVolume = noOfPhysicalDisksInRaidVolume;
+        this.stripeSize = stripeSize;
+
+    }
+
+    public String getLvName() {
+        return lvName;
+    }
+
+    public List<StorageDevice> getDisks() {
+        return disks;
+    }
+
+    public void setLvName(String lvName) {
+        this.lvName = lvName;
+    }
+
+    public void setDisks(List<StorageDevice> disks) {
+        this.disks = disks;
+    }
+
+    public RaidType getRaidType() {
+        return raidType;
+    }
+
+    public Integer getNoOfPhysicalDisksInRaidVolume() {
+        return noOfPhysicalDisksInRaidVolume;
+    }
+
+    public void setRaidType(RaidType raidType) {
+        this.raidType = raidType;
+    }
+
+    public void setNoOfPhysicalDisksInRaidVolume(Integer 
noOfPhysicalDisksInRaidVolume) {
+        this.noOfPhysicalDisksInRaidVolume = noOfPhysicalDisksInRaidVolume;
+    }
+
+    public Integer getStripeSize() {
+        return stripeSize;
+    }
+
+    public void setStripeSize(Integer stripeSize) {
+        this.stripeSize = stripeSize;
+    }
+
+    public String getMountPoint() {
+        return mountPoint;
+    }
+
+    public void setMountPoint(String mountPoint) {
+        this.mountPoint = mountPoint;
+    }
+
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/RaidType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/RaidType.java
new file mode 100644
index 0000000..a7d0332
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/RaidType.java
@@ -0,0 +1,35 @@
+package org.ovirt.engine.core.common.businessentities;
+
+import java.util.HashMap;
+
+public enum RaidType {
+    None(-1),
+    Raid0(0),
+    Raid1(1),
+    Raid2(4),
+    Raid5(5),
+    Raid6(6),
+    Raid10(10);
+
+    private int intValue;
+    private static final HashMap<Integer, RaidType> mappings = new 
HashMap<Integer, RaidType>();
+
+    static {
+        for (RaidType raidType : values()) {
+            mappings.put(raidType.getValue(), raidType);
+        }
+    }
+
+    private RaidType(int value) {
+        intValue = value;
+    }
+
+    public int getValue() {
+        return intValue;
+    }
+
+    public static RaidType forValue(int value) {
+        return mappings.get(value);
+    }
+
+}
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 7411c84..01b3791 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1253,6 +1253,10 @@
     @DefaultValueAttribute("36")
     GlusterVolumeOptionOwnerGroupVirtValue,
 
+    @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("/gluster-bricks")
+    GlusterDefaultBrickMountPoint,
+
     @Reloadable
     @TypeConverterAttribute(String.class)
     @DefaultValueAttribute("")
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
index 1f4debf..f6bdcb3 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/constants/gluster/GlusterConstants.java
@@ -15,9 +15,12 @@
 
     public static final String NO_OF_BRICKS = "NoOfBricks";
     public static final String BRICK_PATH = "brickpath";
+    public static final String BRICK_NAME = "brickName";
     public static final String SERVER_NAME = "servername";
     public static final String VOLUME_NAME = "glustervolumename";
 
+    public static final String FS_TYPE_XFS = "xfs";
+
     // Variables used in audit messages.
     // Keep the values lowercase to avoid call to String#toLowerCase()
     public static final String CLUSTER = "cluster";
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index 68b062c..bd756b5 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -967,6 +967,10 @@
     ACTION_TYPE_FAILED_SNAPSHOT_ALREADY_EXISTS(ErrorType.CONFLICT),
     
ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_ALREADY_SCHEDULED(ErrorType.CONFLICT),
     
ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_NOT_SCHEDULED(ErrorType.CONFLICT),
+    ACTION_TYPE_FAILED_STORAGE_DEVICE_LOCKED(ErrorType.CONFLICT),
+    ACTION_TYPE_FAILED_STORAGE_DEVICE_REQUIRED(ErrorType.BAD_PARAMETERS),
+    
ACTION_TYPE_FAILED_DIFFERENT_STORAGE_DEVICE_TYPES_SELECTED(ErrorType.BAD_PARAMETERS),
+    ACTION_TYPE_FAILED_DEVICE_IS_ALREADY_IN_USE(ErrorType.BAD_PARAMETERS),
 
     // OpenStack Glance
     ACTION_TYPE_FAILED_IMAGE_DOWNLOAD_ERROR(ErrorType.BAD_PARAMETERS),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/locks/LockingGroup.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/locks/LockingGroup.java
index 8890c94..458424f 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/locks/LockingGroup.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/locks/LockingGroup.java
@@ -21,6 +21,8 @@
     GLUSTER_GEOREP,
     /** this group is used for gluster volume snapshot purpose */
     GLUSTER_SNAPSHOT,
+    /** this group is used to lock Storage Devices in the host */
+    HOST_STORAGE_DEVICES,
     USER_VM_POOL,
     /** This group is used to lock template which is in export domain */
     REMOTE_TEMPLATE,
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
index faee03e..3255827 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
@@ -87,6 +87,7 @@
     GlusterVolumeOptionGroupVirtValue,
     GlusterVolumeOptionOwnerUserVirtValue,
     GlusterVolumeOptionOwnerGroupVirtValue,
+    GlusterDefaultBrickMountPoint,
     CpuPinningEnabled,
     CpuPinMigrationEnabled,
     MigrationSupportForNativeUsb(ConfigAuthType.User),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 4f1fdb9..714f570 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1167,6 +1167,10 @@
 ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_ALREADY_DEACTIVATED=Cannot 
${action} ${type}. Gluster volume snapshot ${snapname} is already de-activated.
 GLUSTER_TASKS_NOT_SUPPORTED_FOR_CLUSTER_LEVEL=Cannot ${action} ${type}. 
Gluster task management is not supported in compatibility version 
${compatibilityVersion}.
 ACTION_TYPE_FAILED_STORAGE_PROVISIONING_NOT_SUPPORTED_BY_CLUSTER=Cannot 
${action} ${type}. The selected cluster doesn't support Storage provisioning.
+ACTION_TYPE_FAILED_STORAGE_DEVICE_LOCKED=Cannot ${action} ${type}. Storage 
Device is locked.
+ACTION_TYPE_FAILED_STORAGE_DEVICE_REQUIRED=Cannot ${action} ${type}. At least 
one storage device is required.
+ACTION_TYPE_FAILED_DIFFERENT_STORAGE_DEVICE_TYPES_SELECTED=Cannot ${action} 
${type}. Different types of storage devices are selected.
+ACTION_TYPE_FAILED_DEVICE_IS_ALREADY_IN_USE=Cannot ${action} ${type}. Storage 
Device ${storageDevice} is already in use.
 
 ACTION_TYPE_FAILED_TAG_ID_REQUIRED=Cannot ${action} ${type}. Tag ID is 
required.
 ACTION_TYPE_FAILED_QOS_OUT_OF_RANGE_VALUES=Cannot ${action} ${type}. Values 
are out of range.
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index e230d39..7d87b46 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -849,6 +849,8 @@
 GLUSTER_MASTER_VOLUME_SNAPSHOT_RESTORE_FAILED=Could not restore master volume 
${glusterVolumeName}.
 GLUSTER_VOLUME_SNAPSHOT_CREATED=Snapshot ${snapname} created for volume 
${glusterVolumeName}.
 GLUSTER_VOLUME_SNAPSHOT_CREATE_FAILED=Could not create ${snapname} for volume 
${glusterVolumeName}.
+CREATE_GLUSTER_BRICK=Brick ${brickName} created successfully.
+CREATE_GLUSTER_BRICK_FAILED=Failed to create brick ${brickName}.
 
 VDS_UNTRUSTED=Host ${VdsName} was set to non-operational. Host is not trusted 
by the attestation service.
 USER_ADDED_NETWORK_QOS=Network QoS ${QosName} was added. (User: ${UserName})
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
index 06c3726..212b050 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/ExecutionMessages.properties
@@ -97,6 +97,7 @@
 job.ReplaceGlusterVolumeBrick=Replacing Brick in Gluster Volume 
${GlusterVolume}
 job.AddBricksToGlusterVolume=Adding Bricks to Gluster Volume ${GlusterVolume}
 job.RemoveGlusterServer=Removing Gluster Server ${VDS}
+job.CreateBrick=Creating Brick {brickName} on ${VDS}
 job.RegisterDisk=Registering Disk ${DiskAlias}
 job.AddEventSubscription=Adding subscriber ${Address} to event type 
${EventType}
 job.RemoveEventSubscription=Removing subscriber ${Address} from event type 
${EventType}
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 3b2c02e..d129e49 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -212,6 +212,8 @@
 select fn_db_add_config_value('GlusterBrickProvisioningEnabled', 'false', 
'3.5');
 select 
fn_db_add_config_value('GlusterStorageDeviceListMountPointsToIgore','/,/home,/boot','general');
 select 
fn_db_add_config_value('GlusterStorageDeviceListFileSystemTypesToIgore','swap','general');
+select 
fn_db_add_config_value('GlusterDefaultBrickMountPoint','/gluster-bricks','general');
+
 
 -- OpenStack related
 select fn_db_add_config_value('KeystoneAuthUrl', '', 'general');


-- 
To view, visit https://gerrit.ovirt.org/40041
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23fa314118324ca3f441d43852b8c57c54245308
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5-gluster
Gerrit-Owner: Ramesh N <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to