예제 #1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (!(obj instanceof NetworkClusterId)) {
     return false;
   }
   NetworkClusterId other = (NetworkClusterId) obj;
   if (clusterId == null) {
     if (other.clusterId != null) {
       return false;
     }
   } else if (!clusterId.equals(other.clusterId)) {
     return false;
   }
   if (networkId == null) {
     if (other.networkId != null) {
       return false;
     }
   } else if (!networkId.equals(other.networkId)) {
     return false;
   }
   return true;
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   event_notification_hist other = (event_notification_hist) obj;
   if (auditLogId != other.auditLogId) return false;
   if (eventName == null) {
     if (other.eventName != null) return false;
   } else if (!eventName.equals(other.eventName)) return false;
   if (methodType == null) {
     if (other.methodType != null) return false;
   } else if (!methodType.equals(other.methodType)) return false;
   if (reason == null) {
     if (other.reason != null) return false;
   } else if (!reason.equals(other.reason)) return false;
   if (sentAt == null) {
     if (other.sentAt != null) return false;
   } else if (!sentAt.equals(other.sentAt)) return false;
   if (status != other.status) return false;
   if (subscriberId == null) {
     if (other.subscriberId != null) return false;
   } else if (!subscriberId.equals(other.subscriberId)) return false;
   return true;
 }
예제 #3
0
  /**
   * Checks if the user needs additional permissions in order to connect to the console.
   *
   * @return <code>true</code> if additional permissions are needed, <code>false</code> otherwise
   */
  private boolean needPermissionForConnectingToConsole() {
    // Check if the virtual machine has the flag that allows forced connection to
    // any user, in that case no additional permission is needed:
    final VM vm = getVm();
    if (vm == null || vm.getAllowConsoleReconnect()) {
      return false;
    }

    // If this is not the first user to connect to the console then it does need
    // additional permissions:
    final Guid currentId = getCurrentUser().getId();
    final Guid previousId = vm.getConsoleUserId();
    if (previousId != null && !previousId.equals(currentId)) {
      log.warn(
          "User '{}' is trying to take the console of virtual machine '{}', but the console is already"
              + " taken by user '{}'.",
          currentId,
          vm.getId(),
          previousId);
      return true;
    }

    // If we are here then the user is the first to connect to the console, so no
    // additional permissions are needed:
    return false;
  }
  @Override
  protected void init() {
    // skipped if participating in compensation flow
    if (getParameters() == null) {
      return;
    }

    Guid templateIdToUse = getParameters().getVmStaticData().getVmtGuid();
    // if set to use latest version, get it from db and use it as template
    if (getParameters().getVmStaticData().isUseLatestVersion()) {
      VmTemplate latest = getVmTemplateDao().getTemplateWithLatestVersionInChain(templateIdToUse);

      if (latest != null) {
        // if not using original template, need to override storage mappings
        // as it may have different set of disks
        if (!templateIdToUse.equals(latest.getId())) {
          getParameters().setDiskInfoDestinationMap(null);
        }

        setVmTemplate(latest);
        templateIdToUse = latest.getId();
        getParameters().getVmStaticData().setVmtGuid(templateIdToUse);
      }
    }

    setVmTemplateId(templateIdToUse);
    initTemplate();
    ensureDestinationImageMap();

    nameForVmInPoolGenerator = new NameForVmInPoolGenerator(getParameters().getVmPool().getName());
  }
예제 #5
0
  protected boolean initVdss() {
    setVdsIdRef(getVm().getRunOnVds());
    Guid vdsToRunOn =
        schedulingManager.schedule(
            getVdsGroup(),
            getVm(),
            getVdsBlackList(),
            getVdsWhiteList(),
            getDestinationHostList(),
            new ArrayList<String>(),
            new VdsFreeMemoryChecker(this),
            getCorrelationId());
    setDestinationVdsId(vdsToRunOn);
    if (vdsToRunOn != null && !Guid.Empty.equals(vdsToRunOn)) {
      getRunVdssList().add(vdsToRunOn);
    }
    VmHandler.updateVmGuestAgentVersion(getVm());

    if (vdsToRunOn != null && vdsToRunOn.equals(Guid.Empty)) {
      return false;
    }

    if (getDestinationVds() == null || getVds() == null) {
      return false;
    }

    return true;
  }
예제 #6
0
 private boolean isCurrentTaskLookedFor(Guid id, SPMTask task) {
   return (task instanceof CommandAsyncTask)
       && task.getParameters().getEntityInfo() != null
       && id.equals(task.getParameters().getEntityInfo().getId())
       && (task.getState() != AsyncTaskState.Cleared)
       && (task.getState() != AsyncTaskState.ClearFailed);
 }
예제 #7
0
 /**
  * Check if VDSGroup item with specified id exist in List
  *
  * @param items
  * @param id
  * @return
  */
 public static boolean IsClusterItemExistInList(List<VDSGroup> items, Guid id) {
   for (VDSGroup a : items) {
     if (id.equals(a.getId())) {
       return true;
     }
   }
   return false;
 }
예제 #8
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   QuotaStorage other = (QuotaStorage) obj;
   if (quotaId == null) {
     if (other.quotaId != null) return false;
   } else if (!quotaId.equals(other.quotaId)) return false;
   if (quotaStorageId == null) {
     if (other.quotaStorageId != null) return false;
   } else if (!quotaStorageId.equals(other.quotaStorageId)) return false;
   if (storageId == null) {
     if (other.storageId != null) return false;
   } else if (!storageId.equals(other.storageId)) return false;
   if (storageLimitGigaByte == null) {
     if (other.storageLimitGigaByte != null) return false;
   } else if (!storageLimitGigaByte.equals(other.storageLimitGigaByte)) return false;
   return true;
 }
  @Override
  public boolean equals(Object obj) {
    if (!(obj instanceof GlusterVolumeOptionEntity)) {
      return false;
    }

    GlusterVolumeOptionEntity option = (GlusterVolumeOptionEntity) obj;
    return (getId().equals(option.getId())
        && (volumeId != null && volumeId.equals(option.getVolumeId()))
        && key.equals(option.getKey())
        && value.equals(option.getValue()));
  }
예제 #10
0
 private void updateActionAvailability() {
   getRemoveCommand()
       .setIsExecutionAllowed((getSelectedItems() != null && getSelectedItems().size() > 0));
   if (getRemoveCommand().getIsExecutionAllowed() == false) {
     return;
   }
   Guid entityGuid = getEntityGuid();
   for (Object p : getSelectedItems()) {
     if (!entityGuid.equals(((Permissions) p).getObjectId())) {
       getRemoveCommand().setIsExecutionAllowed(false);
       return;
     }
   }
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   StoragePoolIsoMapId other = (StoragePoolIsoMapId) obj;
   if (storageId == null) {
     if (other.storageId != null) return false;
   } else if (!storageId.equals(other.storageId)) return false;
   if (storagePoolId == null) {
     if (other.storagePoolId != null) return false;
   } else if (!storagePoolId.equals(other.storagePoolId)) return false;
   return true;
 }
 /**
  * Determines whether [is already subscribed] [the specified subscriptions].
  *
  * @param subscriptions The subscriptions.
  * @param subscriberId The subscriber id.
  * @param eventName Name of the event.
  * @param eventNotificationMethod The notification method.
  * @return <c>true</c> if [is already subscribed] [the specified subscriptions]; otherwise,
  *     <c>false</c>.
  */
 private static boolean IsAlreadySubscribed(
     Iterable<event_subscriber> subscriptions,
     Guid subscriberId,
     String eventName,
     EventNotificationMethod eventNotificationMethod) {
   boolean retval = false;
   for (event_subscriber eventSubscriber : subscriptions) {
     if (subscriberId.equals(eventSubscriber.getsubscriber_id())
         && StringUtils.equals(eventSubscriber.getevent_up_name(), eventName)
         && eventSubscriber.getevent_notification_method() == eventNotificationMethod) {
       retval = true;
       break;
     }
   }
   return retval;
 }
  protected void InitVdss() {
    setVdsIdRef(new Guid(getVm().getrun_on_vds().toString()));
    setVdsDestinationId(getVdsSelector().GetVdsToRunOn());
    // make _destinationVds null in order to refresh it from db in case it
    // changed.
    _destinationVds = null;
    if (_vdsDestinationId != null && _vdsDestinationId.equals(Guid.Empty)) {
      throw new VdcBLLException(VdcBllErrors.RESOURCE_MANAGER_CANT_ALLOC_VDS_MIGRATION);
    }
    if (getDestinationVds() == null) {
      throw new VdcBLLException(VdcBllErrors.RESOURCE_MANAGER_VDS_NOT_FOUND);
    }

    if (getVds() == null) {
      throw new VdcBLLException(VdcBllErrors.RESOURCE_MANAGER_VDS_NOT_FOUND);
    }
  }
예제 #14
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (!(obj instanceof VmBase)) {
     return false;
   }
   VmBase other = (VmBase) obj;
   if (autoStartup != other.autoStartup) {
     return false;
   }
   if (autosuspend != other.autosuspend) {
     return false;
   }
   if (cpusPerSocket != other.cpusPerSocket) {
     return false;
   }
   if (creationDate == null) {
     if (other.creationDate != null) {
       return false;
     }
   } else if (!creationDate.equals(other.creationDate)) {
     return false;
   }
   if (defaultBootSequence != other.defaultBootSequence) {
     return false;
   }
   if (description == null) {
     if (other.description != null) {
       return false;
     }
   } else if (!description.equals(other.description)) {
     return false;
   }
   if (domain == null) {
     if (other.domain != null) {
       return false;
     }
   } else if (!domain.equals(other.domain)) {
     return false;
   }
   if (fail_back != other.fail_back) {
     return false;
   }
   if (hypervisorType != other.hypervisorType) {
     return false;
   }
   if (id == null) {
     if (other.id != null) {
       return false;
     }
   } else if (!id.equals(other.id)) {
     return false;
   }
   if (initrdUrl == null) {
     if (other.initrdUrl != null) {
       return false;
     }
   } else if (!initrdUrl.equals(other.initrdUrl)) {
     return false;
   }
   if (isoPath == null) {
     if (other.isoPath != null) {
       return false;
     }
   } else if (!isoPath.equals(other.isoPath)) {
     return false;
   }
   if (kernelParams == null) {
     if (other.kernelParams != null) {
       return false;
     }
   } else if (!kernelParams.equals(other.kernelParams)) {
     return false;
   }
   if (kernelUrl == null) {
     if (other.kernelUrl != null) {
       return false;
     }
   } else if (!kernelUrl.equals(other.kernelUrl)) {
     return false;
   }
   if (mOs != other.mOs) {
     return false;
   }
   if (memSizeMB != other.memSizeMB) {
     return false;
   }
   if (niceLevel != other.niceLevel) {
     return false;
   }
   if (numOfSockets != other.numOfSockets) {
     return false;
   }
   if (numOfMonitors != other.numOfMonitors) {
     return false;
   }
   if (operationMode != other.operationMode) {
     return false;
   }
   if (origin != other.origin) {
     return false;
   }
   if (priority != other.priority) {
     return false;
   }
   if (stateless != other.stateless) {
     return false;
   }
   if (timezone == null) {
     if (other.timezone != null) {
       return false;
     }
   } else if (!timezone.equals(other.timezone)) {
     return false;
   }
   if (usbPolicy != other.usbPolicy) {
     return false;
   }
   if (vds_group_id == null) {
     if (other.vds_group_id != null) {
       return false;
     }
   } else if (!vds_group_id.equals(other.vds_group_id)) {
     return false;
   }
   if (vmType != other.vmType) {
     return false;
   }
   if (quotaId == null) {
     if (other.quotaId != null) return false;
   } else if (!quotaId.equals(other.quotaId)) return false;
   return true;
 }
예제 #15
0
 @Override
 public boolean Match(VDSGroup source) {
   return id.equals(source.getId());
 }
예제 #16
0
 @Override
 public boolean Match(storage_pool source) {
   return id.equals(source.getId());
 }