Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 751f0ac51 -> 7bbad0491


CLOUDSTACK-6671: Fixing NPE when a mapping is missing
Adding missing KVM mappings

Testing Done:
Local testing with removing CentOS mapping and launch a VM.

Signed-off-by: Nitin Mehta <nitin.me...@citrix.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7bbad049
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7bbad049
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7bbad049

Branch: refs/heads/4.4-forward
Commit: 7bbad0491f7ec087f693814caadbe6d648d2edf2
Parents: 751f0ac
Author: Amogh Vasekar <amogh.vase...@citrix.com>
Authored: Wed May 21 08:26:15 2014 -0700
Committer: Nitin Mehta <nitin.me...@citrix.com>
Committed: Wed May 21 08:27:27 2014 -0700

----------------------------------------------------------------------
 .../src/com/cloud/hypervisor/XenServerGuru.java |  6 +++++-
 server/src/com/cloud/hypervisor/KVMGuru.java    |  6 +++++-
 setup/db/db/schema-430to440.sql                 | 22 +++++++++++++++++++-
 3 files changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bbad049/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java 
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
index 620d711..c10f4a0 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
@@ -93,7 +93,11 @@ public class XenServerGuru extends HypervisorGuruBase 
implements HypervisorGuru
         to.setOs(guestOS.getDisplayName());
         HostVO host = hostDao.findById(vm.getVirtualMachine().getHostId());
         GuestOSHypervisorVO guestOsMapping = 
_guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), 
getHypervisorType().toString(), host.getHypervisorVersion());
-        to.setPlatformEmulator(guestOsMapping.getGuestOsName());
+        if (guestOsMapping == null) {
+            to.setPlatformEmulator(null);
+        } else {
+            to.setPlatformEmulator(guestOsMapping.getGuestOsName());
+        }
 
         return to;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bbad049/server/src/com/cloud/hypervisor/KVMGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/KVMGuru.java 
b/server/src/com/cloud/hypervisor/KVMGuru.java
index 4225232..287b0d2 100644
--- a/server/src/com/cloud/hypervisor/KVMGuru.java
+++ b/server/src/com/cloud/hypervisor/KVMGuru.java
@@ -61,7 +61,11 @@ public class KVMGuru extends HypervisorGuruBase implements 
HypervisorGuru {
         to.setOs(guestOS.getDisplayName());
         HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId());
         GuestOSHypervisorVO guestOsMapping = 
_guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), 
getHypervisorType().toString(), host.getHypervisorVersion());
-        to.setPlatformEmulator(guestOsMapping.getGuestOsName());
+        if (guestOsMapping == null) {
+            to.setPlatformEmulator(null);
+        } else {
+            to.setPlatformEmulator(guestOsMapping.getGuestOsName());
+        }
 
         return to;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bbad049/setup/db/db/schema-430to440.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-430to440.sql b/setup/db/db/schema-430to440.sql
index 89db04a..7fa93e7 100644
--- a/setup/db/db/schema-430to440.sql
+++ b/setup/db/db/schema-430to440.sql
@@ -1674,4 +1674,24 @@ CREATE TABLE `cloud`.`network_acl_item_cidrs` (
 
 ALTER TABLE `cloud`.`load_balancer_healthcheck_policies` ADD COLUMN `display` 
tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the policy can be displayed to 
the end user';
 ALTER TABLE `cloud`.`load_balancer_stickiness_policies` ADD COLUMN `display` 
tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the policy can be displayed to 
the end user';
-
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'CentOS 5 (64-bit)', 140, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Red Hat Enterprise Linux 6.0', 136, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Red Hat Enterprise Linux 6.0', 137, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Ubuntu 12.04', 164, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Ubuntu 10.10', 156, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Ubuntu 10.10', 157, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 5', 72, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 5', 15, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 6', 133, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 6', 132, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Other Linux', 69, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Other Linux', 70, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Windows Server 2008', 54, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Windows 2000', 105, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Windows NT', 64, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Windows 3.1', 65, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Other PV', 160, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'FreeBSD 10', 225, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'FreeBSD 10', 226, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Other PV', 139, now(), 0);
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, 
hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) 
VALUES (UUID(),'KVM', 'default', 'Other PV', 140, now(), 0);

Reply via email to