weizhouapache commented on code in PR #7094:
URL: https://github.com/apache/cloudstack/pull/7094#discussion_r1072541492


##########
engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql:
##########
@@ -1035,3 +1035,16 @@ WHERE   role_id = (SELECT id FROM `cloud`.`roles` WHERE 
name = 'Read-Only User -
 INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, 
`permission`)
 SELECT UUID(), `roles`.`id`, 'isAccountAllowedToCreateOfferingsWithTags', 
'ALLOW'
 FROM `cloud`.`roles` WHERE `role_type` = 'DomainAdmin';
+
+--- Create table for handling allowed console session temporally #7094
+
+CREATE TABLE IF NOT EXISTS `cloud`.`console_session` (
+    `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
+    `uuid` varchar(40) NOT NULL COMMENT 'UUID generated for the session',
+    `created` datetime NOT NULL COMMENT 'When the session was created',
+    `account_id` bigint(20) unsigned NOT NULL COMMENT 'Account who generated 
the session' references cloud.account(id),

Review Comment:
   the table can be created successfully
   however, the references do not have any impact.
   
   ```
   MariaDB [cloud]> insert into console_session values 
(1,uuid(),now(),1111,2222,3333,4444,now());
   Query OK, 1 row affected (0.01 sec)
   
   MariaDB [cloud]> insert into console_session values 
(2,uuid(),now(),1111111,22222222,3333333,4444444,now());
   Query OK, 1 row affected (0.00 sec)
   
   MariaDB [cloud]> show create table console_session\G
   *************************** 1. row ***************************
          Table: console_session
   Create Table: CREATE TABLE `console_session` (
     `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
     `uuid` varchar(40) NOT NULL COMMENT 'UUID generated for the session',
     `created` datetime NOT NULL COMMENT 'When the session was created',
     `account_id` bigint(20) unsigned NOT NULL COMMENT 'Account who generated 
the session',
     `user_id` bigint(20) unsigned NOT NULL COMMENT 'User who generated the 
session',
     `instance_id` bigint(20) unsigned NOT NULL COMMENT 'VM for which the 
session was generated',
     `host_id` bigint(20) unsigned NOT NULL COMMENT 'Host where the VM was when 
the session was generated',
     `removed` datetime DEFAULT NULL COMMENT 'When the session was 
removed/used',
     PRIMARY KEY (`id`)
   ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
   1 row in set (0.00 sec)
   
   ```
   
   please refer to 
   
    
    
https://github.com/apache/cloudstack/blob/d0293c4532602f63d445d9c56539ee4f9f51409e/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql#L563-L575



##########
server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java:
##########
@@ -303,6 +310,16 @@ private ConsoleEndpoint 
composeConsoleAccessEndpoint(String rootUrl, VirtualMach
         return consoleEndpoint;
     }
 
+    protected void persistConsoleSession(String sessionUuid, long instanceId, 
long hostId) {
+        ConsoleSessionVO consoleSessionVo = new ConsoleSessionVO();
+        consoleSessionVo.setUuid(sessionUuid);

Review Comment:
   these lines can be replaced by a constructor



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to