org.ovirt.engine.core.compat.Guid.createGuidFromString()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.ovirt.engine.core.compat.Guid.createGuidFromString()方法的一些代码示例,展示了Guid.createGuidFromString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Guid.createGuidFromString()方法的具体详情如下:
包路径:org.ovirt.engine.core.compat.Guid
类名称:Guid
方法名:createGuidFromString

Guid.createGuidFromString介绍

暂无

代码示例

代码示例来源:origin: oVirt/ovirt-engine

public BackendIscsiBondNetworksResource(String iscsiBondId) {
  super(QueryType.GetNetworksByIscsiBondId);
  this.iscsiBondId = Guid.createGuidFromString(iscsiBondId);
}

代码示例来源:origin: oVirt/ovirt-engine

public BackendIscsiBondStorageConnectionsResource(String iscsiBondId) {
  super();
  this.iscsiBondId = Guid.createGuidFromString(iscsiBondId);
}

代码示例来源:origin: oVirt/ovirt-engine

private static LinkedList<Guid> convertToGuidList(String str, char delimiter) {
  LinkedList<Guid> results = new LinkedList<>();
  if (str != null) {
    for (String id : str.split(String.format(" *%s *", delimiter))) {
      results.add(Guid.createGuidFromString(id));
    }
  }
  return results;
}

代码示例来源:origin: oVirt/ovirt-engine

private static Guid getEntityId(String fileName) {
  return Guid.createGuidFromString(fileName.substring(0, fileName.length() - OVF_FILE_EXT.length()));
}

代码示例来源:origin: oVirt/ovirt-engine

private void readDedicatedHostsList(XmlNode content) {
  vmBase.setDedicatedVmForVdsList(new LinkedList<>()); // initialize to empty list
  for (XmlNode hostNode : selectNodes(content, DEDICATED_VM_FOR_VDS)) {
    if (hostNode != null && StringUtils.isNotEmpty(hostNode.innerText)) {
      vmBase.getDedicatedVmForVdsList().add(Guid.createGuidFromString(hostNode.innerText));
    }
  }
}

代码示例来源:origin: oVirt/ovirt-engine

/**
 * Finds the provider that corresponds to the given identifier.
 *
 * @param resource the resource that will be used to perform the required queries
 * @param id the identifier of the provider
 * @return the reference to the provider or {@code null} if no such provider exists
 */
public static Provider getProvider(BackendResource resource, String id) {
  Guid guid = Guid.createGuidFromString(id);
  IdQueryParameters parameters = new IdQueryParameters(guid);
  return resource.getEntity(Provider.class, QueryType.GetProviderById, parameters, id, true);
}

代码示例来源:origin: oVirt/ovirt-engine

public static Guid fetchLeaseDomainId(String ovfData) {
  Guid leaseDomainId = null;
  try {
    XmlDocument xmlDocument = new XmlDocument(ovfData);
    XmlNode xmlNode = xmlDocument.selectSingleNode("//*/Content").selectSingleNode("LeaseDomainId");
    if (xmlNode != null) {
      leaseDomainId = Guid.createGuidFromString(xmlNode.innerText);
    }
  } catch (Exception e) {
    log.debug("failed to parse a given ovf configuration: \n" + ovfData, e);
  }
  return leaseDomainId;
}

代码示例来源:origin: oVirt/ovirt-engine

public Set<Guid> fetchVmDisks(XmlDocument xmlDocument) {
  Set<Guid> disksIds = new HashSet<>();
  XmlNode references = xmlDocument.selectSingleNode("//*/References");
  // we assume that all files in OVFs that are generated by oVirt are disks
  for (XmlNode file : references.selectNodes("File")) {
    disksIds.add(Guid.createGuidFromString(file.attributes.get("ovf:href").getValue().substring(0, GUID_LENGTH)));
  }
  disksIds.addAll(fetchMemoryDisks(xmlDocument));
  return disksIds;
}

代码示例来源:origin: oVirt/ovirt-engine

private static Guid getTargetVnicProfileId(VnicProfileMapping model) {
    return model.isSetTargetVnicProfile()
        ? Guid.createGuidFromString(model.getTargetVnicProfile().getId())
        //this will set the target vnic profile to <empty> (no profile)
        : null;
  }
}

代码示例来源:origin: oVirt/ovirt-engine

private void setRngDevice(Template model) {
  List<VmRngDevice> rngDevices = getEntity(List.class,
      QueryType.GetRngDevice,
      new IdQueryParameters(Guid.createGuidFromString(model.getId())),
      "GetRngDevice", true);
  if (rngDevices != null && !rngDevices.isEmpty()) {
    model.setRngDevice(RngDeviceMapper.map(rngDevices.get(0), null));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

public static void setRngDevice(BackendResource resouce, Vm vm) {
    List<VmRngDevice> rngDevices = resouce.getEntity(List.class,
        QueryType.GetRngDevice,
        new IdQueryParameters(Guid.createGuidFromString(vm.getId())),
        "GetRngDevice", true);

    if (rngDevices != null && !rngDevices.isEmpty()) {
      vm.setRngDevice(RngDeviceMapper.map(rngDevices.get(0), null));
    }
  }
}

代码示例来源:origin: oVirt/ovirt-engine

protected void setRngDevice(VmPool model) {
  List<VmRngDevice> rngDevices = getEntity(List.class,
      QueryType.GetRngDevice,
      new IdQueryParameters(Guid.createGuidFromString(model.getId())),
      "GetRngDevice", true);
  if (rngDevices != null && !rngDevices.isEmpty()) {
    model.setRngDevice(RngDeviceMapper.map(rngDevices.get(0), null));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

private void setRngDevice(InstanceType model) {
  List<VmRngDevice> rngDevices = getEntity(List.class,
    QueryType.GetRngDevice,
    new IdQueryParameters(Guid.createGuidFromString(model.getId())),
    "GetRngDevice", true);
  if (rngDevices != null && !rngDevices.isEmpty()) {
    model.setRngDevice(RngDeviceMapper.map(rngDevices.get(0), null));
  }
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public DiskAttachment get() {
  return performGet(QueryType.GetDiskVmElementById, new VmDeviceIdQueryParameters(new VmDeviceId(Guid.createGuidFromString(diskId), templateId)), Template.class);
}

代码示例来源:origin: oVirt/ovirt-engine

@Mapping(from = org.ovirt.engine.api.model.ClusterFeature.class, to = AdditionalFeature.class)
public static AdditionalFeature map(org.ovirt.engine.api.model.ClusterFeature model, AdditionalFeature template) {
  AdditionalFeature entity = template != null ? template : new AdditionalFeature();
  entity.setName(model.getName());
  entity.setId(Guid.createGuidFromString(model.getId()));
  return entity;
}

代码示例来源:origin: oVirt/ovirt-engine

@Override
public DiskAttachment get() {
  DiskAttachment diskAttachment = performGet(QueryType.GetDiskVmElementById, new VmDeviceIdQueryParameters(new VmDeviceId(Guid.createGuidFromString(diskId), vmId)), Vm.class);
  /*
   * Href of the diskattachment must be set manually due to a bug (https://bugzilla.redhat.com/1647018).
   * The bug is the result of an exceptional case where the same entity (disk-attachment)
   * has the same parent (vm) in 2 different locations in the API, causing ambiguity
   * in the link generation process.
   */
  diskAttachment.setHref("/ovirt-engine/api/vms/" + vmId.toString() + "/diskattachments/" + diskAttachment.getId());
  return diskAttachment;
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void testGetAllConnectionsOfNfsDomain() {
 List<StorageServerConnections> connections = dao.getAllForDomain(Guid.createGuidFromString("d9ede37f-e6c3-4bf9-a984-19174070aa31"));
 assertEquals(1, connections.size());
 assertEquals("0cc146e8-e5ed-482c-8814-270bc48c2981", connections.get(0).getId());
}

代码示例来源:origin: oVirt/ovirt-engine

private void flush() {
  LibvirtSecret secret = isNew() ? new LibvirtSecret() : getEntity();
  secret.setUsageType(getUsageType().getSelectedItem());
  secret.setDescription(getDescription().getEntity());
  secret.setProviderId(Guid.createGuidFromString(getProviderId().getEntity()));
  secret.setId(Guid.createGuidFromString(uuid.getEntity()));
  if (StringHelper.isNotNullOrEmpty(getValue().getEntity())) {
    secret.setValue(getValue().getEntity());
  }
  setEntity(secret);
}

代码示例来源:origin: oVirt/ovirt-engine

private Response performCreate(ImageTransfer imageTransfer, TransferDiskImageParameters params) {
  updateTransferType(imageTransfer, params);
  if (imageTransfer.isSetHost() && imageTransfer.getHost().isSetId()) {
    params.setVdsId(Guid.createGuidFromString(imageTransfer.getHost().getId()));
  }
  if (imageTransfer.isSetInactivityTimeout()) {
    params.setClientInactivityTimeout(imageTransfer.getInactivityTimeout());
  }
  return performCreate(ActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(QueryType.GetImageTransferById,
      IdQueryParameters.class));
}

代码示例来源:origin: oVirt/ovirt-engine

@Test
public void testUpdateHostPinningPolicy() {
  final VmStatic vmTemplate = new VmStatic();
  vmTemplate.setDedicatedVmForVdsList(Guid.newGuid());
  final Vm vm = new Vm();
  vm.setPlacementPolicy(createPlacementPolicy(Guid.newGuid(), Guid.newGuid()));
  final VmStatic mappedVm = VmMapper.map(vm, vmTemplate);
  final List<Guid> hosts = new ArrayList<>();
  for (Host host : vm.getPlacementPolicy().getHosts().getHosts()){
    hosts.add(Guid.createGuidFromString(host.getId()));
  }
  assertEquals(new HashSet(hosts), new HashSet(mappedVm.getDedicatedVmForVdsList()));
}

相关文章