故障现象:Centos7.3使用yum安装完cloudstack-agent后,尝试启动cloudstack-agent服务,看了下,服务无法正常启动,要么就是启动后,马上就停止了,查看日志发现如下报错:

# cat /var/log/cloudstack/agent/agent.log 
2017-11-16 23:30:24,507 WARN  [cloud.resource.ServerResourceBase] (main:null) (logid:) Nics are not specified in properties file/db, will try to autodiscover
2017-11-16 23:30:24,512 INFO  [cloud.resource.ServerResourceBase] (main:null) (logid:) Designating private to be nic br0
2017-11-16 23:30:24,534 INFO  [kvm.resource.LibvirtConnection] (main:null) (logid:) No existing libvirtd connection found. Opening a new one
2017-11-16 23:30:24,787 INFO  [org.reflections.Reflections] (main:null) (logid:) Reflections took 51 ms to scan 1 urls, producing 7 keys and 10 values 
2017-11-16 23:30:24,802 ERROR [cloud.agent.AgentShell] (main:null) (logid:) Unable to start agent: Failed to get private nic name
2017-11-16 23:30:35,350 INFO  [cloud.agent.AgentShell] (main:null) (logid:) Agent started
2017-11-16 23:30:35,352 INFO  [cloud.agent.AgentShell] (main:null) (logid:) Implementation Version is 4.9.2.0
2017-11-16 23:30:35,354 INFO  [cloud.agent.AgentShell] (main:null) (logid:) agent.properties found at /etc/cloudstack/agent/agent.properties
2017-11-16 23:30:35,358 INFO  [cloud.agent.AgentShell] (main:null) (logid:) Defaulting to using properties file for storage
2017-11-16 23:30:35,359 INFO  [cloud.agent.AgentShell] (main:null) (logid:) Defaulting to the constant time backoff algorithm
2017-11-16 23:30:35,373 INFO  [cloud.utils.LogUtils] (main:null) (logid:) log4j configuration found at /etc/cloudstack/agent/log4j-cloud.xml
2017-11-16 23:30:35,385 INFO  [cloud.agent.AgentShell] (main:null) (logid:) Using default Java settings for IPv6 preference for agent connection
2017-11-16 23:30:35,509 INFO  [cloud.agent.Agent] (main:null) (logid:) id is 
2017-11-16 23:30:35,512 WARN  [cloud.resource.ServerResourceBase] (main:null) (logid:) Nics are not specified in properties file/db, will try to autodiscover
2017-11-16 23:30:35,518 INFO  [cloud.resource.ServerResourceBase] (main:null) (logid:) Designating private to be nic br0
2017-11-16 23:30:35,543 INFO  [kvm.resource.LibvirtConnection] (main:null) (logid:) No existing libvirtd connection found. Opening a new one
2017-11-16 23:30:35,807 INFO  [org.reflections.Reflections] (main:null) (logid:) Reflections took 49 ms to scan 1 urls, producing 7 keys and 10 values 
2017-11-16 23:30:35,822 ERROR [cloud.agent.AgentShell] (main:null) (logid:) Unable to start agent: Failed to get private nic name


然后我发现我的systemctl start cloudstack-agent,服务根本不起来,一开始有点陷入误区,查了很多办法,都没法解决问题。

尝试解决方法(添加主机):

一次cloudstack启动cloudstack-agent报错的处理过程

输入主机名称,用户名,密码

一次cloudstack启动cloudstack-agent报错的处理过程

添加成功后,我们查看下cloudstack下agent的状态

一次cloudstack启动cloudstack-agent报错的处理过程然后我们查看下cloudstack-agent的配置文件:

# cat /etc/cloudstack/agent/agent.properties 
#Storage
#Thu Nov 16 23:35:18 CST 2017
guest.network.device=br0
workers=5
private.network.device=br0
port=8250
resource=com.cloud.hypervisor.kvm.resource.LibvirtComputingResource
pod=1
zone=1
hypervisor.type=kvm
guid=a9e231ac-d361-3d25-9692-efeb9e35bf3d
public.network.device=br0
cluster=1
local.storage.uuid=2a89854c-a9f6-46e1-8378-767a25ddb0ec
domr.scripts.dir=scripts/network/domr/kvm
LibvirtComputingResource.id=7
host=172.16.2.1

当我们遇到当前没法处理的时候,不妨试着往下一步走,人生不也是如此么。