H Alena,

I am just trying to fix an old contribution that I applied as it
seemed not to harm in a basic test. revert didn't work so I am looking
for a quick remedy. The original patch does it for shared only. I
don't care either way. Lets do the best thing.

the code now

        if (vm.getType() == Type.User
                &&
_networkModel.areServicesSupportedInNetwork(network.getId(),
Service.Dhcp)
                && network.getTrafficType() == TrafficType.Guest
                && network.getGuestType() == GuestType.Shared) {
            // remove the dhcpservice ip if this is the last nic in subnet.
            DhcpServiceProvider dhcpServiceProvider =
getDhcpServiceProvider(network);
            if (dhcpServiceProvider != null
                    &&
isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)
                    && isLastNicInSubnet(nic)) {
                removeDhcpServiceInSubnet(nic);
            }
        }

What do you sugest?

        if (vm.getType() == Type.User
                &&
_networkModel.areServicesSupportedInNetwork(network.getId(),
Service.Dhcp)) {
            // remove the dhcpservice ip if this is the last nic in subnet.
            DhcpServiceProvider dhcpServiceProvider =
getDhcpServiceProvider(network);
            if (dhcpServiceProvider != null
                    &&
isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)
                    && isLastNicInSubnet(nic)
                && network.getTrafficType() == TrafficType.Guest
                && network.getGuestType() == GuestType.Shared) {
                removeDhcpServiceInSubnet(nic);
            }
        }

???

On Fri, Feb 7, 2014 at 6:56 PM, Alena Prokharchyk
<alena.prokharc...@citrix.com> wrote:
> Daan,
>
> 1) What is the reason you execute this code snippet just for Shared
> networks?
> 2) As I suggested in my prev email, before retrieving Dhcpprovider, you
> should check if dhcp service is enabled on the network. Use method
> areServicesSupportedInNetwork
>  From NetworkModel to check that.
>
> -Alena.
>
> On 2/6/14, 10:04 PM, "Daan Hoogland" <daan.hoogl...@gmail.com> wrote:
>
>>Alena,
>>
>>The revert didn't apply. Would the folowing do the trick?
>>
>>        if (vm.getType() == Type.User
>>                && network.getTrafficType() == TrafficType.Guest
>>                && network.getGuestType() == GuestType.Shared) {
>>            // remove the dhcpservice ip if this is the last nic in
>>subnet.
>>            DhcpServiceProvider dhcpServiceProvider =
>>getDhcpServiceProvider(network);
>>            if (dhcpServiceProvider != null
>>                    &&
>>isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)
>>                    && isLastNicInSubnet(nic)) {
>>                removeDhcpServiceInSubnet(nic);
>>            }
>>        }
>>
>>On Fri, Feb 7, 2014 at 6:55 AM, Daan Hoogland <daan.hoogl...@gmail.com>
>>wrote:
>>> second thought,
>>>
>>> Soheils mail bounces and the commit does not refer a ticket from jira.
>>> I am going to revert. I should have been more vigilant. sorry.
>>>
>>> On Fri, Feb 7, 2014 at 6:49 AM, Daan Hoogland <daan.hoogl...@gmail.com>
>>>wrote:
>>>> will do Alena,
>>>>
>>>> thanks for the headsup
>>>>
>>>> On Thu, Feb 6, 2014 at 10:42 PM, Alena Prokharchyk
>>>> <alena.prokharc...@citrix.com> wrote:
>>>>> Soheil/Daan,
>>>>>
>>>>> The commit in the subject breaks network System vms destroy (VR, SSVM,
>>>>> CPVM), resulting in the network removal failures. Following line
>>>>>replacement
>>>>> causes the failure:
>>>>>
>>>>> - if (vm.getType() == Type.User &&
>>>>> isDhcpAccrossMultipleSubnetsSupported(network) &&
>>>>>isLastNicInSubnet(nic) &&
>>>>> network.getTrafficType() == TrafficType.Guest
>>>>>
>>>>> With
>>>>>
>>>>> +        DhcpServiceProvider dhcpServiceProvider =
>>>>> getDhcpServiceProvider(network);
>>>>>
>>>>>
>>>>> When you try to call getDhcpServiceProvider(network), it throws an
>>>>>exception
>>>>> because DHCP service is not enabled in Public/Control networks of
>>>>>system vms
>>>>> nics. So system vm always fails to expunge.
>>>>>
>>>>> Could you please fix it by checking if DHCP service is enabled on the
>>>>> network, before getting the DHCP service provider?
>>>>>
>>>>> Thanks,
>>>>> Alena.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Daan
>>>
>>>
>>>
>>> --
>>> Daan
>>
>>
>>
>>--
>>Daan
>



-- 
Daan

Reply via email to