-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing SEC_ACL_MAP entries for freespacemgrs
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...rc/main/java/com/linbit/linstor/dbcp/migration/Migration_2018_09_03_FreeSpaceMgr_ACL.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.linbit.linstor.dbcp.migration; | ||
|
||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
|
||
@Migration( | ||
version = "2018.09.03.14.30", | ||
description = "Fix FreeSpaceMgr SEC_ACL_MAP entries." | ||
) | ||
public class Migration_2018_09_03_FreeSpaceMgr_ACL extends LinstorMigration | ||
{ | ||
@Override | ||
public void migrate(Connection connection) throws Exception | ||
{ | ||
Statement stmt = connection.createStatement(); | ||
stmt.executeUpdate( | ||
"INSERT INTO SEC_ACL_MAP SELECT CONCAT('/freespacemgrs/', sp.FREE_SPACE_MGR_NAME), acl_map.ROLE_NAME, " + | ||
"acl_map.ACCESS_TYPE FROM NODE_STOR_POOL sp JOIN SEC_ACL_MAP acl_map ON " + | ||
"CONCAT('/nodes/', sp.NODE_NAME) = acl_map.OBJECT_PATH AND " + | ||
"CONCAT('/freespacemgrs/', sp.FREE_SPACE_MGR_NAME) NOT IN (SELECT object_path FROM SEC_ACL_MAP)" | ||
); | ||
|
||
stmt.executeUpdate( | ||
"UPDATE SEC_OBJECT_PROTECTION SET OWNER_ROLE_NAME='SYSADM', SECURITY_TYPE_NAME='SHARED' " + | ||
"WHERE OBJECT_PATH='/sys/controller/freeSpaceMgrMap'" | ||
); | ||
|
||
stmt.close(); | ||
} | ||
} |