Moti Asayag has uploaded a new change for review.

Change subject: restapi: Allow untagging a network with vlan-id
......................................................................

restapi: Allow untagging a network with vlan-id

The patch allows untagging a network which has a vlan-id
configured by providing the vlan element without specifying
its id, e.g. via PUT:

<network>
    <vlan />
    ...
</network>

Change-Id: Id200dedd19412add194133a6f6554ecf6797f5a8
Bug-Url: https://bugzilla.redhat.com/970635
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java
1 file changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/18489/1

diff --git 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java
 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java
index 138cedf..906b109 100644
--- 
a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java
+++ 
b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/NetworkMapper.java
@@ -45,11 +45,16 @@
                 entity.setGateway(model.getIp().getGateway());
             }
         }
-        if (model.isSetVlan() && model.getVlan().getId()!=null) {
-            try {
-                entity.setVlanId(model.getVlan().getId());
-            } catch (NumberFormatException e) {
-                // REVIST: handle parse error
+        if (model.isSetVlan()) {
+
+            if (model.getVlan().getId() == null) {
+                entity.setVlanId(null);
+            } else {
+                try {
+                    entity.setVlanId(model.getVlan().getId());
+                } catch (NumberFormatException e) {
+                    // REVIST: handle parse error
+                }
             }
         }
         if (model.isSetStp()) {


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

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

Reply via email to