Hi Yiping,

The host IP in global settings is set during first time start of
cloudstack-management service which starts soon after
cloudstack-setup-management script.

CloudStack picks the default NIC as host entry in global settings. Hence,
it doesnt pick the IP that you give along with cloudstack-setupp-databases
script.

In managemnet-server log, you'll notice "ConfigurationServer saved
xx.xx.xx.xx as host" entry that gets added with host ip addition.

Following source snippets form code may help you understand how it assigns
host ip better:
==================================================================
1) cloudstack/server/src/com/cloud/server/ConfigurationServerImpl.java

public void persistDefaultValues() throws InternalErrorException {
.........................
.........................
 String hostIpAdr = NetUtils.getDefaultHostIp();
boolean needUpdateHostIp = true;
if (hostIpAdr != null) {
Boolean devel = Boolean.valueOf(_configDao.getValue("developer"));
if (devel) {
String value =
_configDao.getValue(ApiServiceConfiguration.ManagementHostIPAdr.key());
if (value != null && !value.equals("localhost")) {
needUpdateHostIp = false;
}
}
if (needUpdateHostIp) {
_configDepot.createOrUpdateConfigObject(ApiServiceConfiguration.class.getSimpleName(),
ApiServiceConfiguration.ManagementHostIPAdr, hostIpAdr);
s_logger.debug("ConfigurationServer saved \"" + hostIpAdr + "\" as host.");
}
}

2) cloudstack/utils/src/com/cloud/utils/net/NetUtils.java
.................................
.................................
public static String getDefaultHostIp() {
if (SystemUtils.IS_OS_WINDOWS) {
Pattern pattern =
Pattern.compile("\\s*0.0.0.0\\s*0.0.0.0\\s*(\\S*)\\s*(\\S*)\\s*");
try {
Process result = Runtime.getRuntime().exec("route print -4");
BufferedReader output = new BufferedReader(new
InputStreamReader(result.getInputStream()));
String line = output.readLine();
while (line != null) {
Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
return matcher.group(2);
}
line = output.readLine();
}
} catch (IOException e) {
s_logger.debug("Caught IOException", e);
}

I hope this explanation helps your understanding.

Thanks,
Praveen

On Sat, Feb 14, 2015 at 2:40 AM, Yiping Zhang <yzh...@marketo.com> wrote:

> Update:
>
> Now my mgr¹s eth0 is configured with IP address on the lab network, the
> hostname is set to the name of lab network IP. However, after I run
> cloudstack-setup-databases and cloudstack-setup-management scripts, I
> still find the wrong IP address in global setting param "hosts", and wrong
> value for param ³management.network.cidr².
>
> It looks like that running cloudstack-setup-management script (with
> immediate start of cloudstack-management service) populates DB tables.  So
> my question comes down to how does cloudstack-management service
> determine these configuration values ?
>
> Thanks
>
> Yiping
>
> On 2/11/15, 8:21 PM, "Praveen B" <pbprave...@gmail.com> wrote:
>
> >Hi Zhang,
> >
> >"host" parameter in the global settings will decide system VMs to
> >communicate to MGMT ip address on port 8250. Since you have two IP
> >addresses on management server, CloudStack has picked up your corporate
> >network IP address.
> >
> >As a fix, change the "host" parameter to your lab network IP address and
> >destroy system VMs. New system VMs will point to correct mgmt IP. Let me
> >know how it goes.
> >
> >Thanks,
> >Praveen
> >
> >On Thu, Feb 12, 2015 at 5:39 AM, Yiping Zhang <yzh...@marketo.com> wrote:
> >
> >> Hi, all:
> >>
> >> My  CS management server has two IP addresses: one IP address on our
> >> corporate network (for general access) and one IP address on lab
> >>network ,
> >> which is used at CloudStack¹s management network.
> >>
> >> When I run cloudstack-setup-database script, I have given ³‹mshost²
> >>option
> >> with its IP address on lab network.  However,  when CPVM comes up, the
> >> cloud service is not running . Looking at /var/log/cloud.log file on
> >>CPVM
> >> indicates that it is trying to connect to port 8250 of management
> >>server¹s
> >> IP address on corporate network instead of the IP address on lab
> >>network.
> >> On SSVM, its cloud service also tries to connect to port 8250 of the
> >>wrong
> >> MS IP address
> >>
> >> How does systemVMs decide which IP address on the management server to
> >>use
> >> when starting cloud service ?  How do I make systemVM¹s to use proper
> >> interface on management server ?
> >>
> >> Thanks
> >>
> >> Yiping
> >>
>
>

Reply via email to