sureshanaparti commented on a change in pull request #5911:
URL: https://github.com/apache/cloudstack/pull/5911#discussion_r795558234



##########
File path: engine/schema/src/main/java/com/cloud/upgrade/GuestOsMapper.java
##########
@@ -0,0 +1,193 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.upgrade;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.log4j.Logger;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+import com.cloud.utils.Ternary;
+
+public class GuestOsMapper {
+
+    final static Logger LOG = Logger.getLogger(GuestOsMapper.class);
+
+    private static final String selectGuestOsSql =
+            "SELECT id FROM `cloud`.`guest_os` WHERE category_id = ? AND 
display_name = ? AND is_user_defined = 0 AND removed IS NULL ORDER BY created 
DESC";
+    private static final String insertGuestOsSql =
+            "INSERT INTO `cloud`.`guest_os` (uuid, category_id, display_name, 
created) VALUES (UUID(), ?, ?, now())";
+    private static final String selectGuestOsHypervisorSql =
+            "SELECT guest_os_id FROM `cloud`.`guest_os_hypervisor` WHERE 
hypervisor_type = ? AND hypervisor_version = ? AND guest_os_name = ? AND 
is_user_defined = 0 AND removed IS NULL ORDER BY created DESC";
+    private static final String insertGuestOsHypervisorSql =
+            "INSERT INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created) VALUES (UUID(), ?, ?, 
?, ?, now())";
+    private static final String updateGuestOsSql =
+            "UPDATE `cloud`.`guest_os` SET display_name = ? WHERE id = ?";

Review comment:
       > is the `display_name` the only field we'd want to update?
   
   yes @DaanHoogland 




-- 
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