softlayer - Assign aspecific IP address to an vm -
i creating images of existing virtual machines using following code service.createarchivetransaction(templatename, blockdevices, "image of " + vm.gethostname());
i again creating virtual machines using image through api. virtual machines getting created, public , private ips assigned not ones trying put. either old ips, or new random ips.
i use following code assigning ip: `
// set subnet id dallas 9 string primarybackendipaddress = "10.0.20.98"; //this ip availble user under chosen subnet component netcomp1 = new component(); vlan vlan = new vlan(); vlan.setid(new long(1229225));// id of vlan associated subnet subnet ss1 = new subnet(); ipaddress ipaddr = new ipaddress(); ipaddr.setipaddress("10.0.253.1"); ss1.setendpointipaddress(ipaddr); ss1.setid(new long(1208349)); // setting id of subnet vlan.setprimarysubnet(ss1); netcomp1.setnetworkvlan(vlan); netcomp1.setmaxspeed(new long(1000)); guest.setprimarybackendnetworkcomponent(netcomp1); guest.setprimarybackendipaddress(primarybackendipaddress);
`
i want know if approach correct set private / public ips. if not please advise other methods can use set specific private/public ips while creating vm.
yep approach, depends on method using create vm. need use same method portal uses placeorder, if using createobject method not work, method can specify vlans fronted , backend networks
Comments
Post a Comment