From c8d6bade6ee8fff928228bec67e9b2e86484793d Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Fri, 1 Jul 2016 09:18:35 +0200 Subject: [PATCH] small changes --- .../java/cloud/migration/TestHostOnOff.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/java/cloud/migration/TestHostOnOff.java b/examples/java/cloud/migration/TestHostOnOff.java index 5e8246f72a..68d17ef166 100644 --- a/examples/java/cloud/migration/TestHostOnOff.java +++ b/examples/java/cloud/migration/TestHostOnOff.java @@ -28,7 +28,7 @@ public class TestHostOnOff extends Process{ host1 = Host.getByName("PM1"); host2 = Host.getByName("PM2"); }catch (HostNotFoundException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + Msg.error("You are trying to use a non existing node:" + e.getMessage()); } // Robustness on the SRC node @@ -82,19 +82,17 @@ public class TestHostOnOff extends Process{ try { sourceHost = Host.getByName(args[1]); destHost = Host.getByName(args[2]); - } catch (Exception e) { + } catch (HostNotFoundException e) { + Msg.error("You are trying to migrate from/to a non existing node: " + e.getMessage()); e.printStackTrace(); - System.err.println("You are trying to migrate from/to a non existing node"); } - if (destHost != null) { - if (sourceHost.isOn() && destHost.isOn()) { - try { - Msg.info("Migrate vm "+args[0]+" to node "+destHost.getName()); - VM.getVMByName(args[0]).migrate(destHost); - } catch (HostFailureException e) { - Msg.info("Something occurs during the migration that cannot validate the operation"); - e.printStackTrace(); - } + if (destHost != null && sourceHost.isOn() && destHost.isOn()) { + try { + Msg.info("Migrate vm "+args[0]+" to node "+destHost.getName()); + VM.getVMByName(args[0]).migrate(destHost); + } catch (HostFailureException e) { + Msg.error("Something occurs during the migration that cannot validate the operation: " + e.getMessage()); + e.printStackTrace(); } } } -- 2.20.1