Sahina Bose has uploaded a new change for review. Change subject: engine: Enhance brick to support storage network ......................................................................
engine: Enhance brick to support storage network Enhanced the brick entity to capture details of network used to add the brick. This network will be used for data communication. The network id is null, if the host address is used. Change-Id: I9749febf721172a09ddce756c0eeb745a9502e1a Bug-Url: https://bugzilla.redhat.com/1049994 Signed-off-by: Sahina Bose <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommand.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommandTest.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java M packaging/dbscripts/create_views.sql M packaging/dbscripts/gluster_volumes_sp.sql A packaging/dbscripts/upgrade/03_05_1410_add_network_gluster_bricks.sql 13 files changed, 217 insertions(+), 44 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/40046/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommand.java index 6c5235f..f164870 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommand.java @@ -81,7 +81,7 @@ return false; } - return updateBrickServerNames(getParameters().getBricks(), true) + return updateBrickServerAndInterfaceNames(getParameters().getBricks(), true) && validateDuplicateBricks(getParameters().getBricks()); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java index 76176e9..64757dc 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommand.java @@ -329,7 +329,7 @@ break; } - return updateBrickServerNames(bricks, true) && validateDuplicateBricks(bricks); + return updateBrickServerAndInterfaceNames(bricks, true) && validateDuplicateBricks(bricks); } private void setBrickOrder(List<GlusterBrickEntity> bricks) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java index d0e153f..8aa5985 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java @@ -23,12 +23,17 @@ import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VdsStatic; import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; +import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface; import org.ovirt.engine.core.common.constants.gluster.GlusterConstants; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; +import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.dao.VdsStaticDAO; import org.ovirt.engine.core.dao.gluster.GlusterBrickDao; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; /** * Base class for all Gluster commands @@ -36,6 +41,7 @@ public abstract class GlusterCommandBase<T extends VdcActionParametersBase> extends CommandBase<T> { protected AuditLogType errorType; protected VDS upServer; + private Network glusterNetwork; public GlusterCommandBase(T params) { this(params, null); @@ -130,16 +136,16 @@ getReturnValue().getFault().setError(null); } - protected boolean updateBrickServerNames(List<GlusterBrickEntity> bricks, boolean addCanDoActionMessage) { + protected boolean updateBrickServerAndInterfaceNames(List<GlusterBrickEntity> bricks, boolean addCanDoActionMessage) { for (GlusterBrickEntity brick : bricks) { - if (!updateBrickServerName(brick, addCanDoActionMessage)) { + if (!updateBrickServerAndInterfaceName(brick, addCanDoActionMessage)) { return false; } } return true; } - protected boolean updateBrickServerName(GlusterBrickEntity brick, boolean addCanDoActionMessage) { + protected boolean updateBrickServerAndInterfaceName(GlusterBrickEntity brick, boolean addCanDoActionMessage) { VdsStatic server = getVdsStaticDao().get(brick.getServerId()); if ((server == null || !server.getVdsGroupId().equals(getVdsGroupId()))) { if (addCanDoActionMessage) { @@ -148,7 +154,49 @@ return false; } brick.setServerName(server.getHostName()); + // No interface has been selected to use for brick- + // engine will get the gluster network, if present + if (brick.getNetworkId() == null) { + Network network = getGlusterNetwork(); + if (network != null) { + brick.setNetworkId(network.getId()); + brick.setNetworkAddress(getGlusterNetworkAddress(server.getId(), network.getName())); + } + } else { + // network id has been set, update the address + Network network = getNetworkDAO().get(brick.getNetworkId()); + if (network != null) { + brick.setNetworkAddress(getGlusterNetworkAddress(server.getId(), network.getName())); + } + } + return true; + } + + private Network getGlusterNetwork() { + if (glusterNetwork == null) { + List<Network> allNetworksInCluster = getNetworkDAO().getAllForCluster(getVdsGroupId()); + + for (Network network : allNetworksInCluster) { + if (network.getCluster().isGluster()) { + glusterNetwork = network; + return glusterNetwork; + } + } + } + return glusterNetwork; + } + + private String getGlusterNetworkAddress(Guid hostId, String glusterNetworkName) { + final List<VdsNetworkInterface> nics = + getInterfaceDAO().getAllInterfacesForVds(hostId); + + for (VdsNetworkInterface nic : nics) { + if (glusterNetworkName.equals(nic.getNetworkName())) { + return nic.getAddress(); + } + } + return null; } protected boolean validateDuplicateBricks(List<GlusterBrickEntity> newBricks) { @@ -186,4 +234,14 @@ return getDbFacade().getGlusterBrickDao(); } + protected InterfaceDao getInterfaceDAO() { + return getDbFacade().getInterfaceDao(); + } + + @Override + // overriding for Junit visibility + protected NetworkDao getNetworkDAO() { + return super.getNetworkDAO(); + } + } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommand.java index d75e02f..1e99d70 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommand.java @@ -47,11 +47,11 @@ return false; } - if (!updateBrickServerName(getParameters().getExistingBrick(), true)) { + if (!updateBrickServerAndInterfaceName(getParameters().getExistingBrick(), true)) { return false; } - if (!updateBrickServerName(getParameters().getNewBrick(), true)) { + if (!updateBrickServerAndInterfaceName(getParameters().getNewBrick(), true)) { return false; } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java index 83d6a96..025dcb4 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/AddBricksToGlusterVolumeCommandTest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.spy; @@ -26,6 +27,9 @@ import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType; import org.ovirt.engine.core.common.businessentities.gluster.TransportType; +import org.ovirt.engine.core.common.businessentities.network.Network; +import org.ovirt.engine.core.common.businessentities.network.NetworkCluster; +import org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.compat.Guid; import org.ovirt.engine.core.compat.Version; @@ -33,6 +37,8 @@ import org.ovirt.engine.core.dao.VdsStaticDAO; import org.ovirt.engine.core.dao.gluster.GlusterBrickDao; import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; @RunWith(MockitoJUnitRunner.class) public class AddBricksToGlusterVolumeCommandTest { @@ -52,17 +58,29 @@ @Mock GlusterVolumeValidator validator; - private String serverName = "myhost"; + @Mock + NetworkDao networkDao; - private Guid clusterId = new Guid("c0dd8ca3-95dd-44ad-a88a-440a6e3d8106"); + @Mock + InterfaceDao interfaceDao; - private Guid serverId = new Guid("d7f10a21-bbf2-4ffd-aab6-4da0b3b2ccec"); + private final String serverName = "myhost"; - private Guid volumeId1 = new Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5"); + private final Guid clusterId = new Guid("c0dd8ca3-95dd-44ad-a88a-440a6e3d8106"); - private Guid volumeId2 = new Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e"); + private final Guid serverId = new Guid("d7f10a21-bbf2-4ffd-aab6-4da0b3b2ccec"); + + private final Guid glusterIfaceId = new Guid("bbbb0a21-bbf2-4ffd-aab6-4da0b3b2ccec"); + + private final Guid volumeId1 = new Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5"); + + private final Guid volumeId2 = new Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e"); private static final String BRICK_DIRECTORY = "/tmp/s1"; + + private static final String GLUSTER_NW = "gluster-net"; + + private static final String SERVER_ADDRESS = "10.70.8.8"; /** * The command under test. @@ -128,6 +146,8 @@ doReturn(vdsStaticDao).when(command).getVdsStaticDao(); doReturn(brickDao).when(command).getGlusterBrickDao(); doReturn(validator).when(command).createVolumeValidator(); + doReturn(networkDao).when(command).getNetworkDAO(); + doReturn(interfaceDao).when(command).getInterfaceDAO(); doReturn(getVds(VDSStatus.Up)).when(command).getUpServer(); doReturn(getSingleBrickVolume(volumeId1)).when(volumeDao).getById(volumeId1); @@ -141,6 +161,32 @@ .isForceCreateVolumeAllowed(Version.v3_1, true); } + private void prepareInterfaceMocks(AddBricksToGlusterVolumeCommand command) { + doReturn(getNetworks()).when(networkDao).getAllForCluster(any(Guid.class)); + doReturn(getNetworkInterfaces()).when(interfaceDao).getAllInterfacesForVds(serverId); + } + + private List<Network> getNetworks() { + List<Network> networks = new ArrayList<>(); + Network nw = new Network(); + nw.setName(GLUSTER_NW); + NetworkCluster nc = new NetworkCluster(); + nc.setGluster(true); + nw.setCluster(nc); + networks.add(nw); + return networks; + } + + private List<VdsNetworkInterface> getNetworkInterfaces() { + List<VdsNetworkInterface> ifaces = new ArrayList<>(); + VdsNetworkInterface iface = new VdsNetworkInterface(); + iface.setNetworkName(GLUSTER_NW); + iface.setId(Guid.newGuid()); + iface.setAddress(SERVER_ADDRESS); + ifaces.add(iface); + return ifaces; + } + private VDSGroup getVDsGroup() { VDSGroup vdsGroup = new VDSGroup(); vdsGroup.setId(clusterId); @@ -152,6 +198,7 @@ private VdsStatic getVdsStatic() { VdsStatic vds = new VdsStatic(); + vds.setId(serverId); vds.setVdsGroupId(clusterId); vds.setHostName(serverName); return vds; @@ -214,6 +261,14 @@ } @Test + public void canDoActionFailsDiffInterface() { + cmd = spy(createTestCommand(volumeId1, getBricks(volumeId1, 2), 0, 4, false)); + prepareMocks(cmd); + prepareInterfaceMocks(cmd); + assertFalse(cmd.canDoAction()); + } + + @Test public void canDoActionFailsOnNull() { cmd = spy(createTestCommand(null, null, 0, 0, false)); prepareMocks(cmd); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommandTest.java index d51bc8f..7c2d42e 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/CreateGlusterVolumeCommandTest.java @@ -31,6 +31,8 @@ import org.ovirt.engine.core.dao.VdsStaticDAO; import org.ovirt.engine.core.dao.gluster.GlusterBrickDao; import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; @RunWith(MockitoJUnitRunner.class) public class CreateGlusterVolumeCommandTest { @@ -50,11 +52,17 @@ @Mock GlusterVolumeValidator validator; - private String serverName = "myhost"; + @Mock + NetworkDao networkDao; - private Guid clusterId = new Guid("c0dd8ca3-95dd-44ad-a88a-440a6e3d8106"); + @Mock + InterfaceDao interfaceDao; - private Guid serverId = new Guid("d7f10a21-bbf2-4ffd-aab6-4da0b3b2ccec"); + private final String serverName = "myhost"; + + private final Guid clusterId = new Guid("c0dd8ca3-95dd-44ad-a88a-440a6e3d8106"); + + private final Guid serverId = new Guid("d7f10a21-bbf2-4ffd-aab6-4da0b3b2ccec"); private CreateGlusterVolumeCommand cmd; @@ -93,6 +101,8 @@ doReturn(vdsStaticDao).when(command).getVdsStaticDao(); doReturn(brickDao).when(command).getGlusterBrickDao(); doReturn(validator).when(command).createVolumeValidator(); + doReturn(networkDao).when(command).getNetworkDAO(); + doReturn(interfaceDao).when(command).getInterfaceDAO(); doReturn(getVds(VDSStatus.Up)).when(command).getUpServer(); doReturn(getVdsStatic()).when(vdsStaticDao).get(serverId); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java index 86b46d1..e668f382 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/ReplaceGlusterVolumeBrickCommandTest.java @@ -28,6 +28,8 @@ import org.ovirt.engine.core.compat.Version; import org.ovirt.engine.core.dao.VdsStaticDAO; import org.ovirt.engine.core.dao.gluster.GlusterVolumeDao; +import org.ovirt.engine.core.dao.network.InterfaceDao; +import org.ovirt.engine.core.dao.network.NetworkDao; @RunWith(MockitoJUnitRunner.class) public class ReplaceGlusterVolumeBrickCommandTest { @@ -38,13 +40,19 @@ @Mock VdsStaticDAO vdsStaticDao; - private String serverName = "myhost"; - private Guid clusterId = new Guid("c0dd8ca3-95dd-44ad-a88a-440a6e3d8106"); - private Guid serverId = new Guid("d7f10a21-bbf2-4ffd-aab6-4da0b3b2ccec"); - private Guid volumeId1 = new Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5"); - private Guid volumeId2 = new Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e"); - private Guid volumeId3 = new Guid("000000000000-0000-0000-0000-00000003"); - private Guid volumeId4 = new Guid("000000000000-0000-0000-0000-00000004"); + @Mock + NetworkDao networkDao; + + @Mock + InterfaceDao interfaceDao; + + private final String serverName = "myhost"; + private final Guid clusterId = new Guid("c0dd8ca3-95dd-44ad-a88a-440a6e3d8106"); + private final Guid serverId = new Guid("d7f10a21-bbf2-4ffd-aab6-4da0b3b2ccec"); + private final Guid volumeId1 = new Guid("8bc6f108-c0ef-43ab-ba20-ec41107220f5"); + private final Guid volumeId2 = new Guid("b2cb2f73-fab3-4a42-93f0-d5e4c069a43e"); + private final Guid volumeId3 = new Guid("000000000000-0000-0000-0000-00000003"); + private final Guid volumeId4 = new Guid("000000000000-0000-0000-0000-00000004"); /** * The command under test. @@ -54,6 +62,8 @@ private void prepareMocks(ReplaceGlusterVolumeBrickCommand command) { doReturn(volumeDao).when(command).getGlusterVolumeDao(); doReturn(vdsStaticDao).when(command).getVdsStaticDao(); + doReturn(networkDao).when(command).getNetworkDAO(); + doReturn(interfaceDao).when(command).getInterfaceDAO(); doReturn(getVds(VDSStatus.Up)).when(command).getUpServer(); doReturn(getDistributedVolume(volumeId1)).when(volumeDao).getById(volumeId1); doReturn(getDistributedVolume(volumeId2)).when(volumeDao).getById(volumeId2); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java index 4cfad11..c3c037b 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterBrickEntity.java @@ -34,6 +34,10 @@ @NotNull(message = "VALIDATION.GLUSTER.VOLUME.BRICK.SERVER_ID.NOT_NULL", groups = { CreateEntity.class }) private Guid serverId; + private Guid networkId; + + private String networkAddress; + private String serverName; @NotNull(message = "VALIDATION.GLUSTER.VOLUME.BRICK.BRICK_DIR.NOT_NULL", groups = { CreateEntity.class }) @@ -84,6 +88,22 @@ return brickDirectory; } + public Guid getNetworkId() { + return networkId; + } + + public void setNetworkId(Guid networkId) { + this.networkId = networkId; + } + + public String getNetworkAddress() { + return networkAddress; + } + + public void setNetworkAddress(String networkAddress) { + this.networkAddress = networkAddress; + } + @Override public GlusterStatus getStatus() { return status; @@ -99,12 +119,15 @@ } public String getQualifiedName() { + if (networkId != null && networkAddress != null && !networkAddress.isEmpty()) { + return networkAddress + ":" + brickDirectory; + } return serverName + ":" + brickDirectory; } @Override public String toString() { - return getQualifiedName(); + return getQualifiedName() + "(" + serverName + ")"; } @Override diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java index b760805..25ae268 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/gluster/GlusterBrickDaoDbFacadeImpl.java @@ -53,7 +53,8 @@ .addValue("new_id", newBrick.getId()) .addValue("new_server_id", newBrick.getServerId()) .addValue("new_brick_dir", newBrick.getBrickDirectory()) - .addValue("new_status", EnumUtils.nameOrNull(newBrick.getStatus()))); + .addValue("new_status", EnumUtils.nameOrNull(newBrick.getStatus())) + .addValue("new_network_id", newBrick.getNetworkId())); } @Override @@ -131,7 +132,8 @@ .addValue("server_id", brick.getServerId()) .addValue("brick_dir", brick.getBrickDirectory()) .addValue("brick_order", (brick.getBrickOrder() == null) ? Integer.valueOf(0) : brick.getBrickOrder()) - .addValue("status", EnumUtils.nameOrNull(brick.getStatus())); + .addValue("status", EnumUtils.nameOrNull(brick.getStatus())) + .addValue("network_id", brick.getNetworkId()); } private static final class GlusterBrickRowMapper implements RowMapper<GlusterBrickEntity> { @@ -151,6 +153,9 @@ brick.setBrickOrder(rs.getInt("brick_order")); brick.setStatus(GlusterStatus.valueOf(rs.getString("status"))); brick.getAsyncTask().setTaskId(getGuid(rs, "task_id")); + + brick.setNetworkId(getGuid(rs, "network_id")); + brick.setNetworkAddress(rs.getString("interface_address")); return brick; } } diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java index 6be4056..0304b70 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/gluster/SubTabVolumeBrickView.java @@ -64,7 +64,7 @@ TextColumnWithTooltip<GlusterBrickEntity> directoryColumn = new TextColumnWithTooltip<GlusterBrickEntity>() { @Override public String getValue(GlusterBrickEntity brick) { - return brick.getBrickDirectory(); + return brick.getQualifiedName(); } }; directoryColumn.makeSortable(); diff --git a/packaging/dbscripts/create_views.sql b/packaging/dbscripts/create_views.sql index eb75c0a..f8df82d 100644 --- a/packaging/dbscripts/create_views.sql +++ b/packaging/dbscripts/create_views.sql @@ -1741,22 +1741,28 @@ AS SELECT gluster_volume_bricks.*, vds_static.host_name AS vds_name, - gluster_volumes.vol_name AS volume_name + gluster_volumes.vol_name AS volume_name, + vds_interface.addr as interface_address FROM gluster_volume_bricks INNER JOIN vds_static ON vds_static.vds_id = gluster_volume_bricks.server_id -INNER JOIN gluster_volumes ON gluster_volumes.id = gluster_volume_bricks.volume_id; +INNER JOIN gluster_volumes ON gluster_volumes.id = gluster_volume_bricks.volume_id +LEFT OUTER JOIN network on network.id = gluster_volume_bricks.network_id +LEFT OUTER JOIN vds_interface ON vds_interface.vds_id = gluster_volume_bricks.server_id +AND vds_interface.network_name = network.name; -CREATE OR REPLACE VIEW gluster_volume_task_steps -AS -SELECT step.*, - gluster_volumes.id as volume_id, - job.job_id as job_job_id, - job.action_type, - job.description as job_description, - job.status as job_status, - job.start_time as job_start_time, - job.end_time as job_end_time -FROM gluster_volumes +CREATE +OR REPLACE VIEW gluster_volume_task_steps AS +SELECT + step.*, + gluster_volumes.id AS volume_id, + job.job_id AS job_job_id, + job.action_type, + job.description AS job_description, + job.status AS job_status, + job.start_time AS job_start_time, + job.end_time AS job_end_time +FROM + gluster_volumes INNER JOIN job_subject_entity js ON js.entity_id = gluster_volumes.id INNER JOIN job on job.job_id = js.job_id AND job.action_type in ('StartRebalanceGlusterVolume', 'StartRemoveGlusterVolumeBricks') diff --git a/packaging/dbscripts/gluster_volumes_sp.sql b/packaging/dbscripts/gluster_volumes_sp.sql index 516569f..48f3e56 100644 --- a/packaging/dbscripts/gluster_volumes_sp.sql +++ b/packaging/dbscripts/gluster_volumes_sp.sql @@ -43,12 +43,13 @@ v_server_id UUID, v_brick_dir VARCHAR(4096), v_brick_order INTEGER, - v_status VARCHAR(32)) + v_status VARCHAR(32), + v_network_id UUID) RETURNS VOID AS $procedure$ BEGIN - INSERT INTO gluster_volume_bricks (id, volume_id, server_id, brick_dir, brick_order, status) - VALUES (v_id, v_volume_id, v_server_id, v_brick_dir, v_brick_order, v_status); + INSERT INTO gluster_volume_bricks (id, volume_id, server_id, brick_dir, brick_order, status, network_id) + VALUES (v_id, v_volume_id, v_server_id, v_brick_dir, v_brick_order, v_status, v_network_id); END; $procedure$ LANGUAGE plpgsql; @@ -438,7 +439,7 @@ status = v_status, replica_count = v_replica_count, stripe_count = v_stripe_count, - disprse_count = v_disperse_count, + disperse_count = v_disperse_count, redundancy_count = v_redundancy_count, _update_date = LOCALTIMESTAMP WHERE id = v_id; @@ -466,7 +467,8 @@ v_new_id UUID, v_new_server_id UUID, v_new_brick_dir VARCHAR(4096), - v_new_status VARCHAR(32)) + v_new_status VARCHAR(32), + v_new_network_id UUID) RETURNS VOID AS $procedure$ BEGIN @@ -475,6 +477,7 @@ server_id = v_new_server_id, brick_dir = v_new_brick_dir, status = v_new_status, + network_id = v_new_network_id, _update_date = LOCALTIMESTAMP WHERE id = v_id; END; $procedure$ diff --git a/packaging/dbscripts/upgrade/03_05_1410_add_network_gluster_bricks.sql b/packaging/dbscripts/upgrade/03_05_1410_add_network_gluster_bricks.sql new file mode 100644 index 0000000..be30907 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_05_1410_add_network_gluster_bricks.sql @@ -0,0 +1,3 @@ +select fn_db_add_column('gluster_volume_bricks', 'network_id', 'uuid NULL'); + +SELECT fn_db_create_constraint('gluster_volume_bricks', 'fk_gluster_volume_bricks_network_id', 'FOREIGN KEY (network_id) REFERENCES network(id)'); -- To view, visit https://gerrit.ovirt.org/40046 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9749febf721172a09ddce756c0eeb745a9502e1a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5-gluster Gerrit-Owner: Sahina Bose <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
