@Override public StartupCommand[] initialize() { s_logger.trace("initialize called"); StartupCommand cmd = new StartupCommand(getType()); cmd.setName(_name); cmd.setGuid(_guid); cmd.setDataCenter(_zoneId); cmd.setPod(""); cmd.setPrivateIpAddress(""); cmd.setStorageIpAddress(""); cmd.setVersion(GloboDnsResource.class.getPackage().getImplementationVersion()); return new StartupCommand[] {cmd}; }
@Override public void fillNetworkInformation(final StartupCommand cmd) { final String dummyMac = "00:06:0A:0B:0C:0D"; final String dummyNetmask = "255.255.255.0"; if (!_inSystemVM) { cmd.setPrivateIpAddress(_eth1ip); cmd.setPrivateMacAddress(dummyMac); cmd.setPrivateNetmask(dummyNetmask); cmd.setPublicIpAddress(_publicIp); cmd.setPublicMacAddress(dummyMac); cmd.setPublicNetmask(dummyNetmask); cmd.setName(_hostname); } else { super.fillNetworkInformation(cmd); } }
protected void fillNetworkInformation(final StartupCommand cmd) { cmd.setPrivateIpAddress(getConfiguredProperty("private.ip.address", "127.0.0.1")); cmd.setPrivateMacAddress(getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3")); cmd.setPrivateNetmask(getConfiguredProperty("private.ip.netmask", "255.255.255.0")); cmd.setStorageIpAddress(getConfiguredProperty("private.ip.address", "127.0.0.1")); cmd.setStorageMacAddress(getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3")); cmd.setStorageNetmask(getConfiguredProperty("private.ip.netmask", "255.255.255.0")); cmd.setGatewayIpAddress(getConfiguredProperty("gateway.ip.address", "127.0.0.1")); }
s_logger.debug("Parameters for private nic: " + info[0] + " - " + info[1] + "-" + info[2]); cmd.setPrivateIpAddress(info[0]); cmd.setPrivateMacAddress(info[1]); cmd.setPrivateNetmask(info[2]); s_logger.debug("Parameters for storage nic: " + info[0] + " - " + info[1] + "-" + info[2]); cmd.setStorageIpAddress(info[0]); cmd.setStorageMacAddress(info[1]); cmd.setStorageNetmask(info[2]); s_logger.debug("Parameters for public nic: " + info[0] + " - " + info[1] + "-" + info[2]); cmd.setPublicIpAddress(info[0]); cmd.setPublicMacAddress(info[1]); cmd.setPublicNetmask(info[2]); s_logger.debug("Parameters for storage nic 2: " + info[0] + " - " + info[1] + "-" + info[2]); cmd.setStorageIpAddressDeux(info[0]); cmd.setStorageMacAddressDeux(info[1]); cmd.setStorageNetmaskDeux(info[2]);
host = new HostVO(startup.getGuid()); String dataCenter = startup.getDataCenter(); String pod = startup.getPod(); final String cluster = startup.getCluster(); if (checkCIDR(hpv, startup.getPrivateIpAddress(), startup.getPrivateNetmask())) { pod = hpv.getName(); dataCenter = _dcDao.findById(hpv.getDataCenterId()).getName(); throw new IllegalArgumentException("Host " + startup.getPrivateIpAddress() + " sent incorrect data center: " + dataCenter); host.setPodId(podId); host.setClusterId(clusterId); host.setPrivateIpAddress(startup.getPrivateIpAddress()); host.setPrivateNetmask(startup.getPrivateNetmask()); host.setPrivateMacAddress(startup.getPrivateMacAddress()); host.setPublicIpAddress(startup.getPublicIpAddress()); host.setPublicMacAddress(startup.getPublicMacAddress()); host.setPublicNetmask(startup.getPublicNetmask()); host.setStorageIpAddress(startup.getStorageIpAddress()); host.setStorageMacAddress(startup.getStorageMacAddress()); host.setStorageNetmask(startup.getStorageNetmask()); host.setVersion(startup.getVersion()); host.setName(startup.getName()); host.setManagementServerId(_nodeId); host.setStorageUrl(startup.getIqn()); host.setLastPinged(System.currentTimeMillis() >> 10); host.setHostTags(hostTags);
protected void setupStartupCommand(final StartupCommand startup) { InetAddress addr; try { addr = InetAddress.getLocalHost(); } catch (final UnknownHostException e) { s_logger.warn("unknow host? ", e); throw new CloudRuntimeException("Cannot get local IP address"); } final Script command = new Script("hostname", 500, s_logger); final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); final String result = command.execute(parser); final String hostname = result == null ? parser.getLine() : addr.toString(); startup.setId(getId()); if (startup.getName() == null) { startup.setName(hostname); } startup.setDataCenter(getZone()); startup.setPod(getPod()); startup.setGuid(getResourceGuid()); startup.setResourceName(getResourceName()); startup.setVersion(getVersion()); }
if (cmd.getVersion() == null) { cmd.setVersion(Long.toString(System.currentTimeMillis())); host = findHostByGuid(firstCmd.getGuid()); if (host == null) { host = findHostByGuid(firstCmd.getGuidWithoutResource()); s_logger.debug("Found the host " + host.getId() + " by guid: " + firstCmd.getGuid() + ", old host reconnected as new"); hostExists = true; // ensures that host status is left unchanged in case of adding same one again return null;
if (cmd.getVersion() == null) { cmd.setVersion(Long.toString(System.currentTimeMillis())); host = findHostByGuid(firstCmd.getGuid()); if (host == null) { host = findHostByGuid(firstCmd.getGuidWithoutResource()); s_logger.debug("Found the host " + host.getId() + " by guid: " + firstCmd.getGuid() + ", old host reconnected as new"); hostExists = true; // ensures that host status is left