• This topic has 4 replies, 4 voices, and was last updated March 1, 2019 by Wes C.

JSON example for not changing IP, or using DHCP

  • We are failing over our VPGs without changing IP addresses, keeping a static IP that has already been configured in the OS.  I had ran a scipt to update all of our VPGs with updated vmware networks, and in doing so I set some NIC settings that shouldn’t be set.  Now I’m curious if I can fix this.  Basically I ran this for the VPG Settings for every one of our VMs:

    $VMNICJSON = 
    "    {
        ""Failover"":{
        ""Hypervisor"":{
            ""DnsSuffix"":""$VMNICFailoverDNSSuffix"",
            ""IpConfig"":{
                    ""Gateway"":"""",
                    ""IsDhcp"":""false"",
                    ""PrimaryDns"":"""",
                    ""SecondaryDns"":"""",
                    ""StaticIp"":"""",
                    ""SubnetMask"":""""
                },
            ""NetworkIdentifier"":""$VMNICFailoverNetworkIdentifier"",
            ""ShouldReplaceMacAddress"":""false""
                }
            },
        ""NicIdentifier"":""$VMNICIdentifier""
        }"
    
    

    Which made it look like this in the GUI in the NIC settings for each VM in all of our VPGs:

    Edit Selected vNICs

    Network: Proper-Network-Here-8921

    Create new MAC address?  No

    Change vNIC IP Configuration? Yes, STATIC

    IP Address xxx.xxx.xxx.xxx  (Literally, all x, no numbers)

    Subnet Mask xxx.xxx.xxx.xxx

     

    I’m basically curious how I should format that JSON to change the “Change vNIC IP Configurtion?” to “No”

     

    I’ve tried removing the entire “”Ipconfig””:{} section, and tried again by changing “”isDhcp”” from false, to just “””” like the other parameters.  Neither seemed to do the trick.  So far, the only way I can figure out how to fix this is to edit each VPG and and all of the VMs from the UI.  Thanks for any help you may have.

     

     

    
    
    					

    Hi Jason
    Have you tried it with null? Like this:

    $VMNICJSON = 
    "    {
        ""Failover"":{
        ""Hypervisor"":{
            ""DnsSuffix"":""$VMNICFailoverDNSSuffix"",
            ""IpConfig"":{
                    ""Gateway"":null,
                    ""IsDhcp"":""false"",
                    ""PrimaryDns"":null,
                    ""SecondaryDns"":null,
                    ""StaticIp"":null,
                    ""SubnetMask"":null
                },
            ""NetworkIdentifier"":""$VMNICFailoverNetworkIdentifier"",
            ""ShouldReplaceMacAddress"":""false""
                }
            },
        ""NicIdentifier"":""$VMNICIdentifier""
        }"
    
    Sadly Im not able to test this right now..
    
    Tobi

    Tobias B, I just tried it with null exactly like you posted and that didn’t take.  I still have the same thing.  I’m noticing that the ones that are setup as “Change vNIC IP Configuration? No” then the ipconfig parameter appears to be null with no data in it at all.  Such as, no Gateway, IsDhcp, PrimaryDns, etc, not even a parameter for it.  ipconfig is completely empty.  I’ve tried setting as the example below, and it will not remove the “IsDhcp: False” parameter.

    ""IpConfig"": null,
    
    

     

    Did you ever fix this? Running in to the same thing.

    The current way to accomplish this goal is to create the VpgSettings object to edit, then make a DELETE call to remove the information from the NIC settings at https://server:9669/v1/vgpSettings/<vpgSettingsIdentifier>/vms/<vmIdentifier>/nics/<nicIdentifier>, documented here: Zerto Virtual Replication – REST API – VPG Settings – DELETE

    Once you do that, if you deleted any Default settings, you will need to re-apply them with a PUT call to the correct setting. Once everything is up to date, you will then COMMIT the VpgSettings object to save the changes.

    Tagged: 
You must be logged in to create new topics. Click here to login