public static boolean isSecurityGroupEnabledInZone(long zoneId) { DataCenterVO dc = s_zoneDao.findById(zoneId); if (dc == null) { return false; } else { return dc.isSecurityGroupEnabled(); } }
private String getZoneName(final long zoneId) { final DataCenterVO zone = _zoneDao.findById(new Long(zoneId)); if (zone != null) { return zone.getName(); } else { return null; } }
@Override protected HashMap<String, Object> buildConfigParams(HostVO host) { HashMap<String, Object> params = super.buildConfigParams(host); DataCenterVO zone = _dcDao.findById(host.getDataCenterId()); if (zone != null) { boolean securityGroupEnabled = zone.isSecurityGroupEnabled(); params.put("securitygroupenabled", Boolean.toString(securityGroupEnabled)); } return params; }
private boolean isConsoleProxyVmRequired(long dcId) { DataCenterVO dc = _dcDao.findById(dcId); _dcDao.loadDetails(dc); String cpvmReq = dc.getDetail(ZoneConfig.EnableConsoleProxyVm.key()); if (cpvmReq != null) { return Boolean.parseBoolean(cpvmReq); } return true; }
@Override public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) { DataCenterVO dc = _dcDao.findById(plan.getDataCenterId()); if (!dc.isLocalStorageEnabled()) { return null; } return super.allocateToPool(dskCh, vmProfile, plan, avoid, returnUpTo); }
private boolean isBasicZoneNetwok(Network config) { DataCenter zone = _dcDao.findById(config.getDataCenterId()); return (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() == Network.GuestType.Shared && config.getTrafficType() == TrafficType.Guest); }
@Override public void updateNetworkProfile(final NetworkProfile networkProfile) { final DataCenter dc = _dcDao.findById(networkProfile.getDataCenterId()); networkProfile.setDns1(dc.getDns1()); networkProfile.setDns2(dc.getDns2()); }
@Override public void updateNetworkProfile(NetworkProfile networkProfile) { DataCenter dc = _dcDao.findById(networkProfile.getDataCenterId()); networkProfile.setDns1(dc.getDns1()); networkProfile.setDns2(dc.getDns2()); } }
@Override public void updateNicProfile(NicProfile profile, Network network) { DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (profile != null) { profile.setIPv4Dns1(dc.getDns1()); profile.setIPv4Dns2(dc.getDns2()); } }
boolean isNetworkImplemented(final NetworkVO network) { final Network.State state = network.getState(); if (state == Network.State.Implemented) { return true; } else if (state == Network.State.Setup) { final DataCenterVO zone = _dcDao.findById(network.getDataCenterId()); if (!isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()) || zone.getNetworkType() == NetworkType.Basic) { return true; } } return false; }
@Override public void updateNicProfile(final NicProfile profile, final Network network) { final DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (profile != null) { profile.setIPv4Dns1(dc.getDns1()); profile.setIPv4Dns2(dc.getDns2()); } }
@Override public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) { return false; } DataCenterVO dc = zoneDao.findById(vm.getVirtualMachine().getDataCenterId()); if (dc.getNetworkType() == DataCenter.NetworkType.Advanced) { releaseVlan(network, vm); } return true; }
@Override @DB public boolean implement(final Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { Long zoneId = network.getDataCenterId(); DataCenter zone = _dcDao.findById(zoneId); if (zone == null) { throw new CloudRuntimeException("Could not find zone associated to this network"); } CreateOrUpdateDomainCommand cmd = new CreateOrUpdateDomainCommand(network.getNetworkDomain(), GloboDNSTemplateId.value()); callCommand(cmd, zoneId); return true; }
@Override @DB public boolean destroy(final Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { Long zoneId = network.getDataCenterId(); final DataCenter zone = _dcDao.findById(zoneId); if (zone == null) { throw new CloudRuntimeException("Could not find zone associated to this network"); } RemoveDomainCommand cmd = new RemoveDomainCommand(network.getNetworkDomain(), GloboDNSOverride.value()); callCommand(cmd, zoneId); return true; }
private void updateVlanWithNetworkId(VlanVO vlan) { long zoneId = vlan.getDataCenterId(); long networkId = 0L; DataCenterVO zone = _zoneDao.findById(zoneId); if (zone.getNetworkType() == NetworkType.Advanced) { networkId = getSystemNetworkIdByZoneAndTrafficType(zoneId, TrafficType.Public); } else { networkId = getSystemNetworkIdByZoneAndTrafficType(zoneId, TrafficType.Guest); } vlan.setNetworkId(networkId); _vlanDao.update(vlan.getId(), vlan); }
@Override public void updateNicProfile(NicProfile profile, Network network) { DataCenter dc = _dcDao.findById(network.getDataCenterId()); if (profile != null) { profile.setIPv4Dns1(dc.getDns1()); profile.setIPv4Dns2(dc.getDns2()); profile.setIPv6Dns1(dc.getIp6Dns1()); profile.setIPv6Dns2(dc.getIp6Dns2()); } }
public void createStaticRouteCommands(final List<StaticRouteProfile> staticRoutes, final VirtualRouter router, final Commands cmds) { final SetStaticRouteCommand cmd = new SetStaticRouteCommand(staticRoutes); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId())); cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName()); final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString()); cmds.addCommand(cmd); }
public void createStaticRouteCommands(final List<StaticRouteProfile> staticRoutes, final DomainRouterVO router, final Commands cmds) { final SetStaticRouteCommand cmd = new SetStaticRouteCommand(staticRoutes); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId())); cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName()); final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString()); cmds.addCommand(cmd); }
public void createIpAlias(final VirtualRouter router, final List<IpAliasTO> ipAliasTOs, final Long networkid, final Commands cmds) { final String routerip = _routerControlHelper.getRouterIpInNetwork(networkid, router.getId()); final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); final CreateIpAliasCommand ipaliasCmd = new CreateIpAliasCommand(routerip, ipAliasTOs); ipaliasCmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId())); ipaliasCmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName()); ipaliasCmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, routerip); ipaliasCmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString()); cmds.addCommand("ipalias", ipaliasCmd); }
public void createVmDataCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final String publicKey, final Commands cmds) { final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); final String zoneName = _dcDao.findById(router.getDataCenterId()).getName(); cmds.addCommand( "vmdata", generateVmDataCommand(router, nic.getIPv4Address(), vm.getUserData(), serviceOffering, zoneName, nic.getIPv4Address(), vm.getHostName(), vm.getInstanceName(), vm.getId(), vm.getUuid(), publicKey, nic.getNetworkId())); }