You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2012/12/27 22:48:17 UTC

[20/32] git commit: CLOUDSTACK-227: Fix NPE and throw an exception if the network is not found in Xen

CLOUDSTACK-227: Fix NPE and throw an exception if the network is not found in Xen

Signed-off-by: Rohit Yadav <bh...@apache.org>


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

Branch: refs/heads/ui-plugins
Commit: 8f6fdc3efc37a2e97d1b745e9109e1fc85a990f4
Parents: f0c3b4c
Author: Devdeep Singh <de...@citrix.com>
Authored: Sun Dec 23 19:03:03 2012 -0800
Committer: Rohit Yadav <bh...@apache.org>
Committed: Sun Dec 23 19:03:03 2012 -0800

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java           |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8f6fdc3e/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 313703c..36a12b1 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -4333,8 +4333,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             }
             XsLocalNetwork storageNic1 = null;
             storageNic1 = getNetworkByName(conn, _storageNetworkName1);
-            _host.storageNetwork1 = storageNic1.getNetworkRecord(conn).uuid;
-            _host.storagePif1 = storageNic1.getPifRecord(conn).uuid;
+            if (storageNic1 == null) {
+                s_logger.warn("Unable to find storage network " + _storageNetworkName1 + " for host " + _host.ip);
+                throw new IllegalArgumentException("Unable to find storage network " + _storageNetworkName1 + " for host " + _host.ip);
+            } else {
+                _host.storageNetwork1 = storageNic1.getNetworkRecord(conn).uuid;
+                _host.storagePif1 = storageNic1.getPifRecord(conn).uuid;
+            }
 
             XsLocalNetwork storageNic2 = null;
             if (_storageNetworkName2 != null) {