Updated Branches: refs/heads/master f0c3b4c62 -> 8f6fdc3ef
CLOUDSTACK-227: Fix NPE and throw an exception if the network is not found in Xen Signed-off-by: Rohit Yadav <[email protected]> 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/master Commit: 8f6fdc3efc37a2e97d1b745e9109e1fc85a990f4 Parents: f0c3b4c Author: Devdeep Singh <[email protected]> Authored: Sun Dec 23 19:03:03 2012 -0800 Committer: Rohit Yadav <[email protected]> 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) {
