@Override public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { // signal to the dns server that this vm is up and running and set the ip address to hostname mapping. vm.getHostName(); nic.getIPv4Address(); nic.getIPv6Address(); return true; }
protected void applyProfileToNicForRelease(final NicVO vo, final NicProfile profile) { vo.setIPv4Gateway(profile.getIPv4Gateway()); vo.setAddressFormat(profile.getFormat()); vo.setIPv4Address(profile.getIPv4Address()); vo.setIPv6Address(profile.getIPv6Address()); vo.setMacAddress(profile.getMacAddress()); if (profile.getReservationStrategy() != null) { vo.setReservationStrategy(profile.getReservationStrategy()); } vo.setBroadcastUri(profile.getBroadCastUri()); vo.setIsolationUri(profile.getIsolationUri()); vo.setIPv4Netmask(profile.getIPv4Netmask()); }
/** Build VspDhcpVMOption to put on the VM interface */ public VspDhcpVMOption buildVmDhcpOption (NicVO userNic, boolean defaultHasDns, boolean networkHasDns) { VMInstanceVO userVm = _vmInstanceDao.findById(userNic.getInstanceId()); VspDhcpVMOption.Builder vspDhcpVMOptionBuilder = new VspDhcpVMOption.Builder() .nicUuid(userNic.getUuid()) .defaultHasDns(defaultHasDns) .hostname(userVm.getHostName()) .networkHasDns(networkHasDns) .isDefaultInterface(userNic.isDefaultNic()) .domainRouter(VirtualMachine.Type.DomainRouter.equals(userNic.getVmType())); return vspDhcpVMOptionBuilder.build(); }
private void generateUsageEvent(Long serviceOfferingId, VirtualMachine vm, String eventType){ boolean displayVm = true; if(vm.getType() == VirtualMachine.Type.User){ UserVmVO uservm = _userVmDao.findById(vm.getId()); displayVm = uservm.isDisplayVm(); } _userVmMgr.generateUsageEvent(vm, displayVm, eventType); }
protected NicProfile getNicProfileByTrafficType(final VirtualMachineProfile profile, final TrafficType trafficType) { for (final NicProfile nic : profile.getNics()) { if (nic.getTrafficType() == trafficType && nic.getIPv4Address() != null) { return nic; } } return null; }
@Override public void prepareStop(VirtualMachineProfile profile) { UserVmVO vm = _vmDao.findById(profile.getId()); if (vm != null && vm.getState() == State.Stopping) { collectVmDiskStatistics(vm); collectVmNetworkStatistics(vm); } }
@Override public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) { //NetScalerLB vm starts up with 3 Nics //Nic #1 - NS IP //Nic #2 - locallink(guest network) //Nic #3 - public nic for (final NicProfile nic : profile.getNics()) { if(nic.getTrafficType() == TrafficType.Control) { nic.setTrafficType(TrafficType.Guest); } } return true; }
public VirtualMachineModel(VMInstanceVO vm, String uuid) { _uuid = uuid; if (vm != null) { _instanceId = vm.getId(); _instanceName = vm.getInstanceName(); } }
@Override public boolean release(final NicProfile nic, final VirtualMachineProfile vm, final String reservationId) { nic.setBroadcastUri(null); nic.setIsolationUri(null); return true; }
public StopCommand(VirtualMachine vm, boolean isProxy, String urlPort, String publicConsoleProxyIpAddress, boolean executeInSequence, boolean checkBeforeCleanup) { super(vm.getInstanceName(), executeInSequence); this.isProxy = isProxy; this.urlPort = urlPort; this.publicConsoleProxyIpAddress = publicConsoleProxyIpAddress; this.checkBeforeCleanup = checkBeforeCleanup; }
@Override public int compare(final NicVO nic1, final NicVO nic2) { final boolean isDefault1 = nic1.isDefaultNic(); final boolean isDefault2 = nic2.isDefaultNic(); return isDefault1 ^ isDefault2 ? isDefault1 ^ true ? 1 : -1 : 0; } });
/** * We create the mapping of volumes and storage pool to migrate the VMs according to the information sent by the user. * If the user did not enter a complete mapping, the volumes that were left behind will be auto mapped using {@link #createStoragePoolMappingsForVolumes(VirtualMachineProfile, Host, Map, List)} */ protected Map<Volume, StoragePool> createMappingVolumeAndStoragePool(VirtualMachineProfile profile, Host targetHost, Map<Long, Long> userDefinedMapOfVolumesAndStoragePools) { Map<Volume, StoragePool> volumeToPoolObjectMap = buildMapUsingUserInformation(profile, targetHost, userDefinedMapOfVolumesAndStoragePools); List<Volume> volumesNotMapped = findVolumesThatWereNotMappedByTheUser(profile, volumeToPoolObjectMap); createStoragePoolMappingsForVolumes(profile, targetHost, volumeToPoolObjectMap, volumesNotMapped); return volumeToPoolObjectMap; }
@Override public boolean start() { _executor.scheduleWithFixedDelay(new ExpungeTask(), _expungeInterval, _expungeInterval, TimeUnit.SECONDS); _vmIpFetchExecutor.scheduleWithFixedDelay(new VmIpFetchTask(), VmIpFetchWaitInterval.value(), VmIpFetchWaitInterval.value(), TimeUnit.SECONDS); loadVmDetailsInMapForExternalDhcpIp(); return true; }
@Override public boolean preStateTransitionEvent(State oldState, Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { pubishOnEventBus(event.name(), "preStateTransitionEvent", vo, oldState, newState); return true; }
private static boolean isInAssignableState(ConsoleProxyVO proxy) { // console proxies that are in states of being able to serve user VM State state = proxy.getState(); if (state == State.Running) { return true; } return false; }
@Override public void advanceStart(final String vmUuid, final Map<VirtualMachineProfile.Param, Object> params, final DeploymentPlanner planner) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { advanceStart(vmUuid, params, null, planner); }
@Override public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { vm.getHostName(); nic.getIPv4Address(); nic.getIPv6Address(); // signal to the dns server that the vm is being shutdown and remove the mapping. return true; }
public StopCommand(VirtualMachine vm, boolean executeInSequence, boolean checkBeforeCleanup, boolean forceStop) { super(vm.getInstanceName(), executeInSequence); this.checkBeforeCleanup = checkBeforeCleanup; this.forceStop = forceStop; }