Yair Zaslavsky has uploaded a new change for review.

Change subject: core: Removal of DNS root from host name
......................................................................

core: Removal of DNS root from host name

This fix removes the DNS root name from the host name.
The DNS root name appears as "." at the end of the host name.

Change-Id: I14ffafec4853f23a3bfa50793febafbbf97321f2
Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/35/11335/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
index 2b70af0..ebdb25f 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/dns/DnsSRVLocator.java
@@ -208,7 +208,7 @@
         int numOfRecords = attr.size();
         String[] records = new String[numOfRecords];
         for (int counter = 0; counter < numOfRecords; counter++) {
-            records[counter] = (String) attr.get(counter);
+            records[counter] =  (String)attr.get(counter);
         }
 
         return getSRVResult(records);
@@ -321,6 +321,11 @@
             int weight = s.nextInt();
             String port = s.next();
             String host = s.next();
+            //Remove the "root DNS" part from the host name
+            //if exists as "." at the end of the host name
+            if (host.lastIndexOf(".") == host.length() -1) {
+                host = host.substring(0, host.length() - 1);
+            }
             StringBuilder sb = new StringBuilder(host);
             sb.append(":").append(port);
             return new SrvRecord(priority, weight, sb.toString());
@@ -334,7 +339,7 @@
     }
 
     public URI constructURI(String protocol, String address) throws 
URISyntaxException {
-        String[] parts = address.split("\\.:");
+        String[] parts = address.split("\\:");
         if (parts.length != 2) {
             throw new IllegalArgumentException("the address in SRV record 
should contain host and port");
         }


--
To view, visit http://gerrit.ovirt.org/11335
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14ffafec4853f23a3bfa50793febafbbf97321f2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to