GeezerVison is showing github.com — CLOUDSTACK-6931: Set hypervisor.type in agent.properties using clouds… · bugtrap/cloudstack@89854de
File treeExpand file treeCollapse file tree Open diff view settings server/src/com/cloud/hypervisor/kvm/discoverer
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: agent/bindir/cloud-setup-agent.in +12-1Lines changed: 12 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,6 +61,14 @@ def getUserInputs(): | 61 | 61 | if clusterId == "": | 62 | 62 | clusterId = oldCluster | 63 | 63 |
| | 64 | + oldHypervisor = cfo.getEntry("hypervisor") | | 65 | + if oldHypervisor == "": | | 66 | + oldHypervisor = "kvm" | | 67 | + | | 68 | + hypervisor = raw_input("Please input the Hypervisor type kvm/lxc:[%s]"%oldCluster) | | 69 | + if hypervisor == "": | | 70 | + hypervisor = oldHypervisor | | 71 | + | 64 | 72 | try: | 65 | 73 | defaultNic = networkConfig.getDefaultNetwork() | 66 | 74 | except: | @@ -76,7 +84,7 @@ def getUserInputs(): | 76 | 84 | elif network == "": | 77 | 85 | network = defNic | 78 | 86 |
| 79 | | - return [mgtSvr, zoneToken, network, podId, clusterId] | | 87 | + return [mgtSvr, zoneToken, network, podId, clusterId, hypervisor] | 80 | 88 |
| 81 | 89 | if __name__ == '__main__': | 82 | 90 | initLoging("@AGENTLOGDIR@/setup.log") | @@ -90,6 +98,7 @@ if __name__ == '__main__': | 90 | 98 | parser.add_option("-z", "--zone", dest="zone", help="zone id") | 91 | 99 | parser.add_option("-p", "--pod", dest="pod", help="pod id") | 92 | 100 | parser.add_option("-c", "--cluster", dest="cluster", help="cluster id") | | 101 | + parser.add_option("-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type") | 93 | 102 | parser.add_option("-g", "--guid", dest="guid", help="guid") | 94 | 103 | parser.add_option("--pubNic", dest="pubNic", help="Public traffic interface") | 95 | 104 | parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface") | @@ -108,6 +117,7 @@ if __name__ == '__main__': | 108 | 117 | glbEnv.defaultNic = userInputs[2] | 109 | 118 | glbEnv.pod = userInputs[3] | 110 | 119 | glbEnv.cluster = userInputs[4] | | 120 | + glbEnv.hypervisor = userInputs[5] | 111 | 121 | #generate UUID | 112 | 122 | glbEnv.uuid = old_config.getEntry("guid") | 113 | 123 | if glbEnv.uuid == "": | @@ -124,6 +134,7 @@ if __name__ == '__main__': | 124 | 134 | glbEnv.zone = options.zone | 125 | 135 | glbEnv.pod = options.pod | 126 | 136 | glbEnv.cluster = options.cluster | | 137 | + glbEnv.hypervisor = options.hypervisor | 127 | 138 | glbEnv.nics.append(options.prvNic) | 128 | 139 | glbEnv.nics.append(options.pubNic) | 129 | 140 | glbEnv.nics.append(options.guestNic) | |
Collapse file Copy file name to clipboardExpand all lines: agent/conf/agent.properties +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -93,7 +93,7 @@ domr.scripts.dir=scripts/network/domr/kvm | 93 | 93 | #libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver | 94 | 94 |
| 95 | 95 | # set the hypervisor type, values are: kvm, lxc | 96 | | -# hypervisor.type=kvm | | 96 | +hypervisor.type=kvm | 97 | 97 |
| 98 | 98 | # set the hypervisor URI. Usually there is no need for changing this | 99 | 99 | # For KVM: qemu:///system | |
Collapse file Copy file name to clipboardExpand all lines: python/lib/cloudutils/globalEnv.py +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,6 +32,8 @@ def __init__(self): | 32 | 32 | self.pod = None | 33 | 33 | #cluster id or cluster name | 34 | 34 | self.cluster = None | | 35 | + #hypervisor type. KVM/LXC. Default is KVM | | 36 | + self.hypervisor = "kvm" | 35 | 37 | #nics: 0: private nic, 1: guest nic, 2: public nic used by agent | 36 | 38 | self.nics = [] | 37 | 39 | #uuid | |
Collapse file Copy file name to clipboardExpand all lines: python/lib/cloudutils/serviceConfig.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -671,6 +671,7 @@ def configAgent(self): | 671 | 671 | cfo.addEntry("zone", self.syscfg.env.zone) | 672 | 672 | cfo.addEntry("pod", self.syscfg.env.pod) | 673 | 673 | cfo.addEntry("cluster", self.syscfg.env.cluster) | | 674 | + cfo.addEntry("hypervisor.type", self.syscfg.env.hypervisor) | 674 | 675 | cfo.addEntry("port", "8250") | 675 | 676 | cfo.addEntry("private.network.device", self.syscfg.env.nics[0]) | 676 | 677 | cfo.addEntry("public.network.device", self.syscfg.env.nics[1]) | |
Collapse file Copy file name to clipboardExpand all lines: server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -203,6 +203,7 @@ public boolean processTimeout(long agentId, long seq) { | 203 | 203 | parameters += " --pubNic=" + kvmPublicNic; | 204 | 204 | parameters += " --prvNic=" + kvmPrivateNic; | 205 | 205 | parameters += " --guestNic=" + kvmGuestNic; | | 206 | + parameters += " --hypervisor=" + cluster.getHypervisorType().toString().toLowerCase(); | 206 | 207 |
| 207 | 208 | SSHCmdHelper.sshExecuteCmd(sshConnection, "cloudstack-setup-agent " + parameters, 3); | 208 | 209 |
| |
|