Search in sources :

Example 1 with StaticRouteVO

use of com.cloud.network.vpc.StaticRouteVO in project cloudstack by apache.

the class StaticRouteDaoImpl method remove.

@Override
@DB
public boolean remove(Long id) {
    TransactionLegacy txn = TransactionLegacy.currentTxn();
    txn.start();
    StaticRouteVO entry = findById(id);
    if (entry != null) {
        _tagsDao.removeByIdAndType(id, ResourceObjectType.StaticRoute);
    }
    boolean result = super.remove(id);
    txn.commit();
    return result;
}
Also used : TransactionLegacy(com.cloud.utils.db.TransactionLegacy) StaticRouteVO(com.cloud.network.vpc.StaticRouteVO) DB(com.cloud.utils.db.DB)

Example 2 with StaticRouteVO

use of com.cloud.network.vpc.StaticRouteVO in project cosmic by MissionCriticalCloud.

the class StaticRouteDaoImpl method remove.

@Override
@DB
public boolean remove(final Long id) {
    final TransactionLegacy txn = TransactionLegacy.currentTxn();
    txn.start();
    final StaticRouteVO entry = findById(id);
    if (entry != null) {
        _tagsDao.removeByIdAndType(id, ResourceObjectType.StaticRoute);
    }
    final boolean result = super.remove(id);
    txn.commit();
    return result;
}
Also used : TransactionLegacy(com.cloud.utils.db.TransactionLegacy) StaticRouteVO(com.cloud.network.vpc.StaticRouteVO) DB(com.cloud.utils.db.DB)

Example 3 with StaticRouteVO

use of com.cloud.network.vpc.StaticRouteVO in project cosmic by MissionCriticalCloud.

the class ApiDBUtils method findJobInstanceUuid.

public static String findJobInstanceUuid(final AsyncJob job) {
    if (job == null) {
        return null;
    }
    String jobInstanceId = null;
    final ApiCommandJobType jobInstanceType = EnumUtils.fromString(ApiCommandJobType.class, job.getInstanceType(), ApiCommandJobType.None);
    if (job.getInstanceId() == null) {
        // when assert is hit, implement 'getInstanceId' of BaseAsyncCmd and return appropriate instance id
        assert (false);
        return null;
    }
    if (jobInstanceType == ApiCommandJobType.Volume) {
        final VolumeVO volume = ApiDBUtils.findVolumeById(job.getInstanceId());
        if (volume != null) {
            jobInstanceId = volume.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Template || jobInstanceType == ApiCommandJobType.Iso) {
        final VMTemplateVO template = ApiDBUtils.findTemplateById(job.getInstanceId());
        if (template != null) {
            jobInstanceId = template.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.VirtualMachine || jobInstanceType == ApiCommandJobType.ConsoleProxy || jobInstanceType == ApiCommandJobType.SystemVm || jobInstanceType == ApiCommandJobType.DomainRouter) {
        final VMInstanceVO vm = ApiDBUtils.findVMInstanceById(job.getInstanceId());
        if (vm != null) {
            jobInstanceId = vm.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Snapshot) {
        final Snapshot snapshot = ApiDBUtils.findSnapshotById(job.getInstanceId());
        if (snapshot != null) {
            jobInstanceId = snapshot.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Host) {
        final Host host = ApiDBUtils.findHostById(job.getInstanceId());
        if (host != null) {
            jobInstanceId = host.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.StoragePool) {
        final StoragePoolVO spool = ApiDBUtils.findStoragePoolById(job.getInstanceId());
        if (spool != null) {
            jobInstanceId = spool.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.IpAddress) {
        final IPAddressVO ip = ApiDBUtils.findIpAddressById(job.getInstanceId());
        if (ip != null) {
            jobInstanceId = ip.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.PhysicalNetwork) {
        final PhysicalNetworkVO pnet = ApiDBUtils.findPhysicalNetworkById(job.getInstanceId());
        if (pnet != null) {
            jobInstanceId = pnet.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.TrafficType) {
        final PhysicalNetworkTrafficTypeVO trafficType = ApiDBUtils.findPhysicalNetworkTrafficTypeById(job.getInstanceId());
        if (trafficType != null) {
            jobInstanceId = trafficType.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.PhysicalNetworkServiceProvider) {
        final PhysicalNetworkServiceProvider sp = ApiDBUtils.findPhysicalNetworkServiceProviderById(job.getInstanceId());
        if (sp != null) {
            jobInstanceId = sp.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.FirewallRule) {
        final FirewallRuleVO fw = ApiDBUtils.findFirewallRuleById(job.getInstanceId());
        if (fw != null) {
            jobInstanceId = fw.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Account) {
        final Account acct = ApiDBUtils.findAccountById(job.getInstanceId());
        if (acct != null) {
            jobInstanceId = acct.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.User) {
        final User usr = ApiDBUtils.findUserById(job.getInstanceId());
        if (usr != null) {
            jobInstanceId = usr.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.StaticRoute) {
        final StaticRouteVO route = ApiDBUtils.findStaticRouteById(job.getInstanceId());
        if (route != null) {
            jobInstanceId = route.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.PrivateGateway) {
        final VpcGatewayVO gateway = ApiDBUtils.findVpcGatewayById(job.getInstanceId());
        if (gateway != null) {
            jobInstanceId = gateway.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Network) {
        final NetworkVO networkVO = ApiDBUtils.findNetworkById(job.getInstanceId());
        if (networkVO != null) {
            jobInstanceId = networkVO.getUuid();
        }
    } else if (jobInstanceType != ApiCommandJobType.None) {
        // entity table mapping
        assert (false);
    }
    return jobInstanceId;
}
Also used : ProjectAccount(com.cloud.projects.ProjectAccount) UserAccount(com.cloud.user.UserAccount) Account(com.cloud.user.Account) VpcGatewayVO(com.cloud.network.vpc.VpcGatewayVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) NetworkVO(com.cloud.network.dao.NetworkVO) User(com.cloud.user.User) VMTemplateVO(com.cloud.storage.VMTemplateVO) VMInstanceVO(com.cloud.vm.VMInstanceVO) Host(com.cloud.host.Host) PhysicalNetworkTrafficTypeVO(com.cloud.network.dao.PhysicalNetworkTrafficTypeVO) PhysicalNetworkServiceProvider(com.cloud.network.PhysicalNetworkServiceProvider) StaticRouteVO(com.cloud.network.vpc.StaticRouteVO) FirewallRuleVO(com.cloud.network.rules.FirewallRuleVO) VMSnapshot(com.cloud.vm.snapshot.VMSnapshot) Snapshot(com.cloud.storage.Snapshot) VolumeVO(com.cloud.storage.VolumeVO) StoragePoolVO(com.cloud.storage.datastore.db.StoragePoolVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) IPAddressVO(com.cloud.network.dao.IPAddressVO)

Example 4 with StaticRouteVO

use of com.cloud.network.vpc.StaticRouteVO in project cloudstack by apache.

the class ApiDBUtils method findJobInstanceUuid.

public static String findJobInstanceUuid(AsyncJob job) {
    if (job == null) {
        return null;
    }
    String jobInstanceId = null;
    ApiCommandJobType jobInstanceType = EnumUtils.fromString(ApiCommandJobType.class, job.getInstanceType(), ApiCommandJobType.None);
    if (job.getInstanceId() == null) {
        // when assert is hit, implement 'getInstanceId' of BaseAsyncCmd and return appropriate instance id
        assert (false);
        return null;
    }
    if (jobInstanceType == ApiCommandJobType.Volume) {
        VolumeVO volume = ApiDBUtils.findVolumeById(job.getInstanceId());
        if (volume != null) {
            jobInstanceId = volume.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Template || jobInstanceType == ApiCommandJobType.Iso) {
        VMTemplateVO template = ApiDBUtils.findTemplateById(job.getInstanceId());
        if (template != null) {
            jobInstanceId = template.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.VirtualMachine || jobInstanceType == ApiCommandJobType.ConsoleProxy || jobInstanceType == ApiCommandJobType.SystemVm || jobInstanceType == ApiCommandJobType.DomainRouter) {
        VMInstanceVO vm = ApiDBUtils.findVMInstanceById(job.getInstanceId());
        if (vm != null) {
            jobInstanceId = vm.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Snapshot) {
        Snapshot snapshot = ApiDBUtils.findSnapshotById(job.getInstanceId());
        if (snapshot != null) {
            jobInstanceId = snapshot.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Host) {
        Host host = ApiDBUtils.findHostById(job.getInstanceId());
        if (host != null) {
            jobInstanceId = host.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.StoragePool) {
        StoragePoolVO spool = ApiDBUtils.findStoragePoolById(job.getInstanceId());
        if (spool != null) {
            jobInstanceId = spool.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.IpAddress) {
        IPAddressVO ip = ApiDBUtils.findIpAddressById(job.getInstanceId());
        if (ip != null) {
            jobInstanceId = ip.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.SecurityGroup) {
        SecurityGroup sg = ApiDBUtils.findSecurityGroupById(job.getInstanceId());
        if (sg != null) {
            jobInstanceId = sg.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.PhysicalNetwork) {
        PhysicalNetworkVO pnet = ApiDBUtils.findPhysicalNetworkById(job.getInstanceId());
        if (pnet != null) {
            jobInstanceId = pnet.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.TrafficType) {
        PhysicalNetworkTrafficTypeVO trafficType = ApiDBUtils.findPhysicalNetworkTrafficTypeById(job.getInstanceId());
        if (trafficType != null) {
            jobInstanceId = trafficType.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.PhysicalNetworkServiceProvider) {
        PhysicalNetworkServiceProvider sp = ApiDBUtils.findPhysicalNetworkServiceProviderById(job.getInstanceId());
        if (sp != null) {
            jobInstanceId = sp.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.FirewallRule) {
        FirewallRuleVO fw = ApiDBUtils.findFirewallRuleById(job.getInstanceId());
        if (fw != null) {
            jobInstanceId = fw.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Account) {
        Account acct = ApiDBUtils.findAccountById(job.getInstanceId());
        if (acct != null) {
            jobInstanceId = acct.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.User) {
        User usr = ApiDBUtils.findUserById(job.getInstanceId());
        if (usr != null) {
            jobInstanceId = usr.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.StaticRoute) {
        StaticRouteVO route = ApiDBUtils.findStaticRouteById(job.getInstanceId());
        if (route != null) {
            jobInstanceId = route.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.PrivateGateway) {
        VpcGatewayVO gateway = ApiDBUtils.findVpcGatewayById(job.getInstanceId());
        if (gateway != null) {
            jobInstanceId = gateway.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Counter) {
        CounterVO counter = ApiDBUtils.getCounter(job.getInstanceId());
        if (counter != null) {
            jobInstanceId = counter.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Condition) {
        ConditionVO condition = ApiDBUtils.findConditionById(job.getInstanceId());
        if (condition != null) {
            jobInstanceId = condition.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.AutoScalePolicy) {
        AutoScalePolicyVO policy = ApiDBUtils.findAutoScalePolicyById(job.getInstanceId());
        if (policy != null) {
            jobInstanceId = policy.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.AutoScaleVmProfile) {
        AutoScaleVmProfileVO profile = ApiDBUtils.findAutoScaleVmProfileById(job.getInstanceId());
        if (profile != null) {
            jobInstanceId = profile.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.AutoScaleVmGroup) {
        AutoScaleVmGroupVO group = ApiDBUtils.findAutoScaleVmGroupById(job.getInstanceId());
        if (group != null) {
            jobInstanceId = group.getUuid();
        }
    } else if (jobInstanceType == ApiCommandJobType.Network) {
        NetworkVO networkVO = ApiDBUtils.findNetworkById(job.getInstanceId());
        if (networkVO != null) {
            jobInstanceId = networkVO.getUuid();
        }
    } else if (jobInstanceType != ApiCommandJobType.None) {
        // entity table mapping
        assert (false);
    }
    return jobInstanceId;
}
Also used : ProjectAccount(com.cloud.projects.ProjectAccount) UserAccount(com.cloud.user.UserAccount) Account(com.cloud.user.Account) AutoScalePolicyVO(com.cloud.network.as.AutoScalePolicyVO) VpcGatewayVO(com.cloud.network.vpc.VpcGatewayVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) NetworkVO(com.cloud.network.dao.NetworkVO) ApiCommandJobType(org.apache.cloudstack.api.ApiCommandJobType) User(com.cloud.user.User) VMTemplateVO(com.cloud.storage.VMTemplateVO) VMInstanceVO(com.cloud.vm.VMInstanceVO) Host(com.cloud.host.Host) PhysicalNetworkTrafficTypeVO(com.cloud.network.dao.PhysicalNetworkTrafficTypeVO) PhysicalNetworkServiceProvider(com.cloud.network.PhysicalNetworkServiceProvider) StaticRouteVO(com.cloud.network.vpc.StaticRouteVO) SecurityGroup(com.cloud.network.security.SecurityGroup) FirewallRuleVO(com.cloud.network.rules.FirewallRuleVO) VMSnapshot(com.cloud.vm.snapshot.VMSnapshot) Snapshot(com.cloud.storage.Snapshot) AutoScaleVmProfileVO(com.cloud.network.as.AutoScaleVmProfileVO) AutoScaleVmGroupVO(com.cloud.network.as.AutoScaleVmGroupVO) VolumeVO(com.cloud.storage.VolumeVO) StoragePoolVO(org.apache.cloudstack.storage.datastore.db.StoragePoolVO) PhysicalNetworkVO(com.cloud.network.dao.PhysicalNetworkVO) ConditionVO(com.cloud.network.as.ConditionVO) IPAddressVO(com.cloud.network.dao.IPAddressVO) CounterVO(com.cloud.network.as.CounterVO)

Aggregations

StaticRouteVO (com.cloud.network.vpc.StaticRouteVO)4 Host (com.cloud.host.Host)2 PhysicalNetworkServiceProvider (com.cloud.network.PhysicalNetworkServiceProvider)2 IPAddressVO (com.cloud.network.dao.IPAddressVO)2 NetworkVO (com.cloud.network.dao.NetworkVO)2 PhysicalNetworkTrafficTypeVO (com.cloud.network.dao.PhysicalNetworkTrafficTypeVO)2 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)2 FirewallRuleVO (com.cloud.network.rules.FirewallRuleVO)2 VpcGatewayVO (com.cloud.network.vpc.VpcGatewayVO)2 ProjectAccount (com.cloud.projects.ProjectAccount)2 Snapshot (com.cloud.storage.Snapshot)2 VMTemplateVO (com.cloud.storage.VMTemplateVO)2 VolumeVO (com.cloud.storage.VolumeVO)2 Account (com.cloud.user.Account)2 User (com.cloud.user.User)2 UserAccount (com.cloud.user.UserAccount)2 DB (com.cloud.utils.db.DB)2 TransactionLegacy (com.cloud.utils.db.TransactionLegacy)2 VMInstanceVO (com.cloud.vm.VMInstanceVO)2 VMSnapshot (com.cloud.vm.snapshot.VMSnapshot)2