diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 9f8aad9e801..92eab76402d 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -1721,6 +1721,10 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR vmtmpltvdi = cloudVDIcopy(tmpltvdi, poolsr); snapshotvdi = vmtmpltvdi.snapshot(conn, new HashMap()); vmtmpltvdi.destroy(conn); + try{ + poolsr.scan(conn); + } catch (Exception e) { + } snapshotvdi.setNameLabel(conn, "Template " + cmd.getName()); // vmtmpltvdi.setNameDescription(conn, cmd.getDescription()); uuid = snapshotvdi.getUuid(conn); @@ -3152,7 +3156,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR return true; } - protected Nic getLocalNetwork(Connection conn, String name) throws XmlRpcException, XenAPIException { + protected Nic getManageMentNetwork(Connection conn, String name) throws XmlRpcException, XenAPIException { Set networks = Network.getByNameLabel(conn, name); for (Network network : networks) { Network.Record nr = network.getRecord(conn); @@ -3162,7 +3166,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR if (s_logger.isDebugEnabled()) { s_logger.debug("Found a network called " + name + " on host=" + _host.ip + "; Network=" + nr.uuid + "; pif=" + pr.uuid); } - if (pr.bondMasterOf != null && pr.bondMasterOf.size() > 0) { + if (!pr.management && pr.bondMasterOf != null && pr.bondMasterOf.size() > 0) { if (pr.bondMasterOf.size() > 1) { String msg = new StringBuilder("Unsupported configuration. Network " + name + " has more than one bond. Network=").append(nr.uuid) .append("; pif=").append(pr.uuid).toString(); @@ -3194,6 +3198,25 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR return null; } + + protected Nic getLocalNetwork(Connection conn, String name) throws XmlRpcException, XenAPIException { + Set networks = Network.getByNameLabel(conn, name); + for (Network network : networks) { + Network.Record nr = network.getRecord(conn); + for (PIF pif : nr.PIFs) { + PIF.Record pr = pif.getRecord(conn); + if (_host.uuid.equals(pr.host.getUuid(conn))) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Found a network called " + name + " on host=" + _host.ip + "; Network=" + nr.uuid + "; pif=" + pr.uuid); + } + return new Nic(network, nr, pif, pr); + } + } + } + + return null; + } + protected VIF getCorrectVif(VM router, String vlanId) { try { Connection conn = getConnection(); @@ -3520,11 +3543,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR try { Host myself = Host.getByUuid(conn, _host.uuid); - String name = "cloud-private"; - if (_privateNetworkName != null) { - name = _privateNetworkName; - } - _localGateway = callHostPlugin("getgateway", "mgmtIP", myself.getAddress(conn)); if (_localGateway == null || _localGateway.isEmpty()) { s_logger.warn("can not get gateway for host :" + _host.uuid); @@ -3533,7 +3551,15 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR _canBridgeFirewall = can_bridge_firewall(); - Nic privateNic = getLocalNetwork(conn, name); + + Nic privateNic = null; + privateNic = getManageMentNetwork(conn, "cloud-private"); + if( privateNic == null ) { + privateNic = getManageMentNetwork(conn, _privateNetworkName); + } else { + _privateNetworkName = "cloud-private"; + } + String name = _privateNetworkName; if (privateNic == null) { s_logger.debug("Unable to find any private network. Trying to determine that by route for host " + _host.ip); name = callHostPlugin("getnetwork", "mgmtIP", myself.getAddress(conn)); @@ -3542,16 +3568,14 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR return false; } _privateNetworkName = name; - privateNic = getLocalNetwork(conn, name); + privateNic = getManageMentNetwork(conn, name); if (privateNic == null) { s_logger.warn("Unable to get private network " + name); return false; } - } else { - _privateNetworkName = name; + name = privateNic.nr.nameLabel; } - name = privateNic.nr.nameLabel; - + Nic guestNic = null; if (_guestNetworkName != null && !_guestNetworkName.equals(name)) { guestNic = getLocalNetwork(conn, _guestNetworkName); diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 4fba1c03b02..6e07376e110 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -1859,11 +1859,6 @@ public class ManagementServerImpl implements ManagementServer { throw new InvalidParameterValueException("Please specify a valid volume ID."); } - // Check that the volume is stored on shared storage - if (!_storageMgr.volumeOnSharedStoragePool(volume)) { - throw new InvalidParameterValueException("Please specify a volume that has been created on a shared storage pool."); - } - // Check that the volume is not currently attached to any VM if (volume.getInstanceId() != null) { throw new InvalidParameterValueException("Please specify a volume that is not attached to any VM."); diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 892cdaded2d..a90cd6ea544 100644 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1751,9 +1751,6 @@ public class StorageManagerImpl implements StorageManager { List storagePools = _storagePoolDao.listAllActive(); for (StoragePoolVO pool : storagePools) { try { - if (recurring && pool.isLocal()) { - continue; - } List unusedTemplatesInPool = _tmpltMgr.getUnusedTemplatesInPool(pool); s_logger.debug("Storage pool garbage collector found " + unusedTemplatesInPool.size() + " templates to clean up in storage pool: " + pool.getName()); diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index db15b644f50..bb693ff5453 100644 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -479,7 +479,7 @@ public class TemplateManagerImpl implements TemplateManager { VMTemplateVO template = _tmpltDao.findById(templatePoolVO.getTemplateId()); // If this is a routing template, consider it in use - if (template.getUniqueName().equals("routing")) { + if (template.getUniqueName().equals("routing") && pool.isShared() ) { continue; }