http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b61468d6/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java ---------------------------------------------------------------------- diff --cc plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index e2bb597,f2fe65a..8b876cf --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@@ -730,7 -728,38 +728,38 @@@ public class LibvirtComputingResource e } params.put("vm.migrate.speed", String.valueOf(_migrateSpeed)); } - + + Map<String, String> bridges = new HashMap<String, String>(); + bridges.put("linklocal", _linkLocalBridgeName); + bridges.put("public", _publicBridgeName); + bridges.put("private", _privBridgeName); + bridges.put("guest", _guestBridgeName); + + params.put("libvirt.host.bridges", (Object) bridges); + params.put("libvirt.host.pifs", (Object) _pifs); + + // Load the vif driver + String vifDriverName = (String) params.get("libvirt.vif.driver"); + if (vifDriverName == null) { + s_logger.info("No libvirt.vif.driver specififed. Defaults to BridgeVifDriver."); + vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver"; + } + + params.put("libvirt.computing.resource", (Object) this); + + try { + Class<?> clazz = Class.forName(vifDriverName); + _vifDriver = (VifDriver) clazz.newInstance(); + _vifDriver.configure(params); + } catch (ClassNotFoundException e) { + throw new ConfigurationException("Unable to find class for libvirt.vif.driver " + e); + } catch (InstantiationException e) { + throw new ConfigurationException("Unable to instantiate class for libvirt.vif.driver " + e); + } catch (Exception e) { + throw new ConfigurationException("Failed to initialize libvirt.vif.driver " + e); + } + + return true; } @@@ -2632,22 -2632,31 +2634,30 @@@ int devId = (int) volume.getDeviceId(); if (pool.getType() == StoragePoolType.RBD) { - /* - For RBD pools we use the secret mechanism in libvirt. - We store the secret under the UUID of the pool, that's why - we pass the pool's UUID as the authSecret - */ - disk.defNetworkBasedDisk(physicalDisk.getPath().replace("rbd:", ""), pool.getSourceHost(), pool.getSourcePort(), - pool.getAuthUserName(), pool.getUuid(), - devId, diskBusType, diskProtocol.RBD); + /* + For RBD pools we use the secret mechanism in libvirt. + We store the secret under the UUID of the pool, that's why + we pass the pool's UUID as the authSecret + */ + disk.defNetworkBasedDisk(physicalDisk.getPath().replace("rbd:", ""), pool.getSourceHost(), pool.getSourcePort(), + pool.getAuthUserName(), pool.getUuid(), + devId, diskBusType, diskProtocol.RBD); - } else if (volume.getType() == Volume.Type.DATADISK) { - disk.defFileBasedDisk(physicalDisk.getPath(), devId, DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2); + } else if (pool.getType() == StoragePoolType.CLVM) { + disk.defBlockBasedDisk(physicalDisk.getPath(), devId, + diskBusType); + } else { + if (volume.getType() == Volume.Type.DATADISK) { + disk.defFileBasedDisk(physicalDisk.getPath(), devId, + DiskDef.diskBus.VIRTIO, + DiskDef.diskFmtType.QCOW2); - } else { - disk.defFileBasedDisk(physicalDisk.getPath(), devId, - diskBusType, DiskDef.diskFmtType.QCOW2); - } - + } else { + disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.diskFmtType.QCOW2); } } ++ } ++ vm.getDevices().addDevice(disk); }
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b61468d6/server/src/com/cloud/storage/StorageManagerImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b61468d6/ui/scripts/system.js ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b61468d6/ui/scripts/zoneWizard.js ----------------------------------------------------------------------
