> + vm = > client.getVirtualMachineApi().getVirtualMachine(vm.getId()); > + List<Integer> ports = > Ints.asList(templateOptions.getInboundPorts()); > + if (capabilities.getCloudStackVersion().startsWith("2")) { > + logger.debug(">> setting up IP forwarding for > IPAddress(%s) rules(%s)", ip.getId(), ports); > + Set<IPForwardingRule> rules = > setupPortForwardingRulesForIP.apply(ip, ports); > + logger.trace("<< setup %d IP forwarding rules on > IPAddress(%s)", rules.size(), ip.getId()); > + } else { > + logger.debug(">> setting up firewall rules for > IPAddress(%s) rules(%s)", ip.getId(), ports); > + Set<FirewallRule> rules = > setupFirewallRulesForIP.apply(ip, ports); > + logger.trace("<< setup %d firewall rules on > IPAddress(%s)", rules.size(), ip.getId()); > + } > + } > + } > + } catch (RuntimeException re) { > + logger.error("-- exception after node has been created, trying to > destroy the created virtualMachine(%s)", vm.getId()); > + destroyNode(vm.getId());
Hey @demobox . The point of this code is that destroyNode needs to be called before we rethrow the exception. Otherwise the code will have created an instance on the cloud, but will tell the higher level code that creating the instance failed. Please have a look at the discussion about this patch in https://github.com/jclouds/jclouds/issues/184 I think the last consensus was to merge this patch in. I know it's not the best solution, but next to implementing a transaction mechanism with rollbacks this does solve the problems we are having. The issue i'm facing is that due to ipv4 shortage allocating a static nat ip address sometimes fails. When this happens the jcloud-jenkins plugin thinks the creation of the instance fails (and rightfully so) but the instance was created on the cloud. Leaving a lot of unmanaged stale instances around. I've been running production with this "fix" for several months and have yet to see any issues with it. It would be really nice to have this in. Cheers, Hugo --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/328/files#r11014225