private static Pair<StorageDomainStatic, Guid> BuildStorageStaticFromXmlRpcStruct(
      Map<String, Object> xmlRpcStruct) {
    Pair<StorageDomainStatic, Guid> returnValue = new Pair<StorageDomainStatic, Guid>();
    StorageDomainStatic sdStatic = new StorageDomainStatic();
    if (xmlRpcStruct.containsKey("name")) {
      sdStatic.setStorageName(xmlRpcStruct.get("name").toString());
    }
    if (xmlRpcStruct.containsKey("type")) {
      sdStatic.setStorageType(
          EnumUtils.valueOf(StorageType.class, xmlRpcStruct.get("type").toString(), true));
    }
    if (xmlRpcStruct.containsKey("class")) {
      String domainType = xmlRpcStruct.get("class").toString();
      if ("backup".equalsIgnoreCase(domainType)) {
        sdStatic.setStorageDomainType(StorageDomainType.ImportExport);
      } else {
        sdStatic.setStorageDomainType(EnumUtils.valueOf(StorageDomainType.class, domainType, true));
      }
    }
    if (xmlRpcStruct.containsKey("version")) {
      sdStatic.setStorageFormat(StorageFormatType.forValue(xmlRpcStruct.get("version").toString()));
    }
    if (sdStatic.getStorageType() != StorageType.UNKNOWN) {
      if (sdStatic.getStorageType().isFileDomain() && xmlRpcStruct.containsKey("remotePath")) {
        String path = xmlRpcStruct.get("remotePath").toString();
        List<StorageServerConnections> connections =
            DbFacade.getInstance().getStorageServerConnectionDao().getAllForStorage(path);
        if (connections.isEmpty()) {
          sdStatic.setConnection(new StorageServerConnections());
          sdStatic.getConnection().setconnection(path);
          sdStatic.getConnection().setstorage_type(sdStatic.getStorageType());
        } else {
          sdStatic.setStorage(connections.get(0).getid());
          sdStatic.setConnection(connections.get(0));
        }
      } else if (sdStatic.getStorageType() != StorageType.NFS
          && (xmlRpcStruct.containsKey("vguuid"))) {
        sdStatic.setStorage(xmlRpcStruct.get("vguuid").toString());
      }
    }
    if (xmlRpcStruct.containsKey("state")) {
      sdStatic.setSanState(
          EnumUtils.valueOf(
              SANState.class, xmlRpcStruct.get("state").toString().toUpperCase(), false));
    }
    returnValue.setFirst(sdStatic);
    Object[] poolUUIDs = (Object[]) xmlRpcStruct.get("pool");
    if (poolUUIDs.length != 0) {
      returnValue.setSecond(Guid.createGuidFromString(poolUUIDs[0].toString()));
    }

    return returnValue;
  }
  /** <exception>VdcDAL.IrsBrokerIRSErrorException. */
  public DiskImage buildImageEntity(Map<String, Object> xmlRpcStruct) {
    DiskImage newImage = new DiskImage();
    try {
      newImage.setImageId(new Guid((String) xmlRpcStruct.get(IrsProperties.uuid)));

      newImage.setParentId(new Guid((String) xmlRpcStruct.get(IrsProperties.parent)));
      newImage.setDescription((String) xmlRpcStruct.get(IrsProperties.description));
      newImage.setImageStatus(
          EnumUtils.valueOf(
              ImageStatus.class, (String) xmlRpcStruct.get(IrsProperties.ImageStatus), true));
      if (xmlRpcStruct.containsKey(IrsProperties.size)) {
        newImage.setSize(Long.parseLong(xmlRpcStruct.get(IrsProperties.size).toString()) * 512);
      }
      if (xmlRpcStruct.containsKey("capacity")) {
        newImage.setSize(Long.parseLong(xmlRpcStruct.get("capacity").toString()));
      }
      if (xmlRpcStruct.containsKey("truesize")) {
        newImage.setActualSizeInBytes(Long.parseLong(xmlRpcStruct.get("truesize").toString()));
      }
      if (xmlRpcStruct.containsKey("ctime")) {
        long secsSinceEpoch = Long.parseLong(xmlRpcStruct.get("ctime").toString());
        newImage.setCreationDate(MakeDTFromCTime(secsSinceEpoch));
      }
      if (xmlRpcStruct.containsKey("mtime")) {
        long secsSinceEpoch = Long.parseLong(xmlRpcStruct.get("mtime").toString());
        newImage.setLastModifiedDate(MakeDTFromCTime(secsSinceEpoch));
      }
      if (xmlRpcStruct.containsKey("domain")) {
        newImage.setStorageIds(
            new ArrayList<Guid>(Arrays.asList(new Guid(xmlRpcStruct.get("domain").toString()))));
      }
      if (xmlRpcStruct.containsKey("image")) {
        newImage.setimage_group_id(new Guid(xmlRpcStruct.get("image").toString()));
      }
      if (xmlRpcStruct.containsKey("type")) {
        newImage.setVolumeType(
            EnumUtils.valueOf(VolumeType.class, xmlRpcStruct.get("type").toString(), true));
      }
      if (xmlRpcStruct.containsKey("format")) {
        newImage.setvolumeFormat(
            EnumUtils.valueOf(VolumeFormat.class, xmlRpcStruct.get("format").toString(), true));
      }
    } catch (RuntimeException ex) {
      log.errorFormat("irsBroker::buildImageEntity::Failed building DIskImage");
      printReturnValue();
      log.error(ex.getMessage(), ex);
      newImage = null;
    }

    return newImage;
  }