示例#1
0
 /** Returns device parameters. */
 @Override
 protected Map<String, String> getHWParameters(final boolean allParams) {
   Tools.invokeAndWait(
       new Runnable() {
         @Override
         public void run() {
           getInfoPanel();
         }
       });
   final String[] params = getRealParametersFromXML();
   final Map<String, String> parameters = new LinkedHashMap<String, String>();
   for (final String param : params) {
     final String value = getComboBoxValue(param);
     if (DiskData.TYPE.equals(param)) {
       parameters.put(param, value);
     } else if (DiskData.TARGET_BUS_TYPE.equals(param)) {
       if (value == null) {
         parameters.put(DiskData.TARGET_BUS, null);
         parameters.put(DiskData.TARGET_TYPE, null);
       } else {
         final String[] values = value.split("/");
         if (values.length == 2) {
           parameters.put(DiskData.TARGET_BUS, values[0]);
           parameters.put(DiskData.TARGET_TYPE, values[1]);
         } else {
           LOG.appWarning("getHWParameters: cannot parse: " + param + " = " + value);
         }
       }
     } else if (allParams) {
       if (Tools.areEqual(getParamDefault(param), value)) {
         parameters.put(param, null);
       } else {
         parameters.put(param, value);
       }
     } else if (!Tools.areEqual(getParamSaved(param), value)
         || DiskData.SOURCE_FILE.equals(param)
         || DiskData.SOURCE_DEVICE.equals(param)
         || DiskData.SOURCE_PROTOCOL.equals(param)
         || DiskData.SOURCE_NAME.equals(param)
         || DiskData.SOURCE_HOST_NAME.equals(param)
         || DiskData.SOURCE_HOST_PORT.equals(param)
         || DiskData.AUTH_USERNAME.equals(param)
         || DiskData.AUTH_SECRET_TYPE.equals(param)
         || DiskData.AUTH_SECRET_UUID.equals(param)) {
       if (Tools.areEqual(getParamDefault(param), value)) {
         parameters.put(param, null);
       } else {
         parameters.put(param, value);
       }
     }
   }
   parameters.put(DiskData.SAVED_TARGET_DEVICE, getName());
   setName(getParamSaved(DiskData.TARGET_DEVICE));
   return parameters;
 }
示例#2
0
 /** Updates parameters. */
 @Override
 void updateParameters() {
   final Map<String, DiskData> disks = getVMSVirtualDomainInfo().getDisks();
   if (disks != null) {
     final DiskData diskData = disks.get(getName());
     if (diskData != null) {
       for (final String param : getParametersFromXML()) {
         final String oldValue = getParamSaved(param);
         String value = getParamSaved(param);
         final Widget wi = getWidget(param, null);
         for (final Host h : getVMSVirtualDomainInfo().getDefinedOnHosts()) {
           final VMSXML vmsxml = getBrowser().getVMSXML(h);
           if (vmsxml != null) {
             final String savedValue = diskData.getValue(param);
             if (savedValue != null) {
               value = savedValue;
             }
           }
         }
         if (!Tools.areEqual(value, oldValue)) {
           getResource().setValue(param, value);
           if (wi != null) {
             /* only if it is not changed by user. */
             wi.setValue(value);
           }
         }
       }
     }
   }
   updateTable(VMSVirtualDomainInfo.HEADER_TABLE);
   updateTable(VMSVirtualDomainInfo.DISK_TABLE);
   // checkResourceFieldsChanged(null, getParametersFromXML());
   setApplyButtons(null, getRealParametersFromXML());
 }
示例#3
0
 /** Returns device parameters. */
 protected Map<String, String> getHWParameters(final boolean allParams) {
   Tools.invokeAndWait(
       new Runnable() {
         public void run() {
           getInfoPanel();
         }
       });
   final String[] params = getParametersFromXML();
   final Map<String, String> parameters = new HashMap<String, String>();
   for (final String param : getParametersFromXML()) {
     final String value = getComboBoxValue(param);
     if (allParams || !Tools.areEqual(getParamSaved(param), value)) {
       if (Tools.areEqual(getParamDefault(param), value)) {
         parameters.put(param, null);
       } else {
         parameters.put(param, value);
       }
     }
   }
   return parameters;
 }