mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-7362: fix wrong uuid issue for resource tags
(cherry picked from commit 838a1a8476cfb4308103b3797a281f843e208d38)
This commit is contained in:
parent
b035a444c6
commit
880bff28e0
@ -32,6 +32,7 @@ import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.query.dao.ResourceTagJoinDao;
|
||||
@ -167,6 +168,9 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
|
||||
if (entity != null) {
|
||||
return ((InternalIdentity)entity).getId();
|
||||
}
|
||||
if (!StringUtils.isNumeric(resourceId)) {
|
||||
throw new InvalidParameterValueException("Unable to find resource by uuid " + resourceId + " and type " + resourceType);
|
||||
}
|
||||
entity = _entityMgr.findById(clazz, resourceId);
|
||||
if (entity != null) {
|
||||
return ((InternalIdentity)entity).getId();
|
||||
@ -276,6 +280,10 @@ public class TaggedResourceManagerImpl extends ManagerBase implements TaggedReso
|
||||
|
||||
@Override
|
||||
public String getUuid(String resourceId, ResourceObjectType resourceType) {
|
||||
if (!StringUtils.isNumeric(resourceId)) {
|
||||
return resourceId;
|
||||
}
|
||||
|
||||
Class<?> clazz = s_typeMap.get(resourceType);
|
||||
|
||||
Object entity = _entityMgr.findById(clazz, resourceId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user