CLOUDSTACK-7428: Allow LXC cluster in SG enabled zones. Use lxc driver in security_group.py script for lxc host

This commit is contained in:
Kishan Kavala 2014-08-27 01:11:29 +05:30
parent 26904d1a2b
commit 08dc5c6f91
2 changed files with 11 additions and 5 deletions

View File

@ -33,6 +33,11 @@ iptables = Command("iptables")
bash = Command("/bin/bash")
ebtablessave = Command("ebtables-save")
ebtables = Command("ebtables")
driver = "qemu:///system"
cfo = configFileOps("/etc/cloudstack/agent/agent.properties")
hyper = cfo.getEntry("hypervisor.type")
if hyper == "lxc":
driver = "lxc:///"
def execute(cmd):
logging.debug(cmd)
return bash("-c", cmd).stdout
@ -96,7 +101,7 @@ def virshlist(*states):
searchstates = list(libvirt_states[state] for state in states)
conn = libvirt.openReadOnly('qemu:///system')
conn = libvirt.openReadOnly(driver)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(3)
@ -124,7 +129,7 @@ def virshdomstate(domain):
libvirt.VIR_DOMAIN_CRASHED : 'crashed',
}
conn = libvirt.openReadOnly('qemu:///system')
conn = libvirt.openReadOnly(driver)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(3)
@ -141,7 +146,7 @@ def virshdomstate(domain):
def virshdumpxml(domain):
conn = libvirt.openReadOnly('qemu:///system')
conn = libvirt.openReadOnly(driver)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(3)
@ -925,7 +930,7 @@ def getBridges(vmName):
def getvmId(vmName):
conn = libvirt.openReadOnly('qemu:///system')
conn = libvirt.openReadOnly(driver)
if conn == None:
print 'Failed to open connection to the hypervisor'
sys.exit(3)

View File

@ -419,7 +419,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
}
if (zone.isSecurityGroupEnabled() && zone.getNetworkType().equals(NetworkType.Advanced)) {
if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.XenServer && hypervisorType != HypervisorType.Simulator) {
if (hypervisorType != HypervisorType.KVM && hypervisorType != HypervisorType.XenServer
&& hypervisorType != HypervisorType.LXC && hypervisorType != HypervisorType.Simulator) {
throw new InvalidParameterValueException("Don't support hypervisor type " + hypervisorType + " in advanced security enabled zone");
}
}