mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6931: Set hypervisor.type in agent.properties using cloudstack-setup -t option. Default is kvm.
This commit is contained in:
parent
5cbb182c6d
commit
89854de18d
@ -61,6 +61,14 @@ def getUserInputs():
|
||||
if clusterId == "":
|
||||
clusterId = oldCluster
|
||||
|
||||
oldHypervisor = cfo.getEntry("hypervisor")
|
||||
if oldHypervisor == "":
|
||||
oldHypervisor = "kvm"
|
||||
|
||||
hypervisor = raw_input("Please input the Hypervisor type kvm/lxc:[%s]"%oldCluster)
|
||||
if hypervisor == "":
|
||||
hypervisor = oldHypervisor
|
||||
|
||||
try:
|
||||
defaultNic = networkConfig.getDefaultNetwork()
|
||||
except:
|
||||
@ -76,7 +84,7 @@ def getUserInputs():
|
||||
elif network == "":
|
||||
network = defNic
|
||||
|
||||
return [mgtSvr, zoneToken, network, podId, clusterId]
|
||||
return [mgtSvr, zoneToken, network, podId, clusterId, hypervisor]
|
||||
|
||||
if __name__ == '__main__':
|
||||
initLoging("@AGENTLOGDIR@/setup.log")
|
||||
@ -90,6 +98,7 @@ if __name__ == '__main__':
|
||||
parser.add_option("-z", "--zone", dest="zone", help="zone id")
|
||||
parser.add_option("-p", "--pod", dest="pod", help="pod id")
|
||||
parser.add_option("-c", "--cluster", dest="cluster", help="cluster id")
|
||||
parser.add_option("-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type")
|
||||
parser.add_option("-g", "--guid", dest="guid", help="guid")
|
||||
parser.add_option("--pubNic", dest="pubNic", help="Public traffic interface")
|
||||
parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface")
|
||||
@ -108,6 +117,7 @@ if __name__ == '__main__':
|
||||
glbEnv.defaultNic = userInputs[2]
|
||||
glbEnv.pod = userInputs[3]
|
||||
glbEnv.cluster = userInputs[4]
|
||||
glbEnv.hypervisor = userInputs[5]
|
||||
#generate UUID
|
||||
glbEnv.uuid = old_config.getEntry("guid")
|
||||
if glbEnv.uuid == "":
|
||||
@ -124,6 +134,7 @@ if __name__ == '__main__':
|
||||
glbEnv.zone = options.zone
|
||||
glbEnv.pod = options.pod
|
||||
glbEnv.cluster = options.cluster
|
||||
glbEnv.hypervisor = options.hypervisor
|
||||
glbEnv.nics.append(options.prvNic)
|
||||
glbEnv.nics.append(options.pubNic)
|
||||
glbEnv.nics.append(options.guestNic)
|
||||
|
||||
@ -93,7 +93,7 @@ domr.scripts.dir=scripts/network/domr/kvm
|
||||
#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
|
||||
|
||||
# set the hypervisor type, values are: kvm, lxc
|
||||
# hypervisor.type=kvm
|
||||
hypervisor.type=kvm
|
||||
|
||||
# set the hypervisor URI. Usually there is no need for changing this
|
||||
# For KVM: qemu:///system
|
||||
|
||||
@ -32,6 +32,8 @@ class globalEnv:
|
||||
self.pod = None
|
||||
#cluster id or cluster name
|
||||
self.cluster = None
|
||||
#hypervisor type. KVM/LXC. Default is KVM
|
||||
self.hypervisor = "kvm"
|
||||
#nics: 0: private nic, 1: guest nic, 2: public nic used by agent
|
||||
self.nics = []
|
||||
#uuid
|
||||
|
||||
@ -671,6 +671,7 @@ class cloudAgentConfig(serviceCfgBase):
|
||||
cfo.addEntry("zone", self.syscfg.env.zone)
|
||||
cfo.addEntry("pod", self.syscfg.env.pod)
|
||||
cfo.addEntry("cluster", self.syscfg.env.cluster)
|
||||
cfo.addEntry("hypervisor.type", self.syscfg.env.hypervisor)
|
||||
cfo.addEntry("port", "8250")
|
||||
cfo.addEntry("private.network.device", self.syscfg.env.nics[0])
|
||||
cfo.addEntry("public.network.device", self.syscfg.env.nics[1])
|
||||
|
||||
@ -203,6 +203,7 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
|
||||
parameters += " --pubNic=" + kvmPublicNic;
|
||||
parameters += " --prvNic=" + kvmPrivateNic;
|
||||
parameters += " --guestNic=" + kvmGuestNic;
|
||||
parameters += " --hypervisor=" + cluster.getHypervisorType().toString().toLowerCase();
|
||||
|
||||
SSHCmdHelper.sshExecuteCmd(sshConnection, "cloudstack-setup-agent " + parameters, 3);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user