Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 430F6109A1 for ; Mon, 10 Feb 2014 17:46:45 +0000 (UTC) Received: (qmail 49733 invoked by uid 500); 10 Feb 2014 17:46:43 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 49689 invoked by uid 500); 10 Feb 2014 17:46:42 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 49680 invoked by uid 99); 10 Feb 2014 17:46:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Feb 2014 17:46:42 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of Alena.Prokharchyk@citrix.com designates 66.165.176.89 as permitted sender) Received: from [66.165.176.89] (HELO SMTP.CITRIX.COM) (66.165.176.89) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Feb 2014 17:46:35 +0000 X-IronPort-AV: E=Sophos;i="4.95,819,1384300800"; d="scan'208";a="101375191" Received: from sjcpex01cl01.citrite.net ([10.216.14.143]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/AES128-SHA; 10 Feb 2014 17:46:13 +0000 Received: from SJCPEX01CL02.citrite.net ([169.254.2.110]) by SJCPEX01CL01.citrite.net ([10.216.14.143]) with mapi id 14.02.0342.004; Mon, 10 Feb 2014 09:46:06 -0800 From: Alena Prokharchyk To: Daan Hoogland CC: "dev@cloudstack.apache.org" Subject: Re: commit 6523c068695d0431070060667c222eb40d54b14d breaks network removal Thread-Topic: commit 6523c068695d0431070060667c222eb40d54b14d breaks network removal Thread-Index: AQHPI4RFY/438Qk0dE2CpRDlZh33X5qpz9IAgAABv4CAAAKEgIAAQRWAgACIBYD//364AIAAmSgAgAFI94CAAsskAA== Date: Mon, 10 Feb 2014 17:46:04 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.9.131030 x-originating-ip: [10.214.4.75] Content-Type: text/plain; charset="us-ascii" Content-ID: <73CD75D289A9B341A8928AEC9F01010A@citrix.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org No big difference. But its better to evaluate if the network is eligible for the check, before retrieving DHCP provider. IN your code snippet you might retrieve DHCP provider only to discover later that the check is not needed at all. -Alena. On 2/8/14, 7:07 AM, "Daan Hoogland" wrote: >Alena, > >I added unit tests and made a review request for you, >https://reviews.apache.org/r/17872/ > >I have a question though. I can see some small the semantic differnce >between the following two snippits but is only in the evaluation order >of the conditions under which to execute, not in the logic. So what >is the importance of using your version? (just curious) > > > if (vm.getType() =3D=3D Type.User > && >_networkModel.areServicesSupportedInNetwork(network.getId(),Service.Dhcp)) >{ > // remove the dhcpservice ip if this is the last nic in >subnet. > DhcpServiceProvider dhcpServiceProvider =3D >getDhcpServiceProvider(network); > if (dhcpServiceProvider !=3D null > && >isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider) > && isLastNicInSubnet(nic) > && network.getTrafficType() =3D=3D TrafficType.Guest > && network.getGuestType() =3D=3D GuestType.Shared) { > removeDhcpServiceInSubnet(nic); > } > } > > > >if (vm.getType() =3D=3D Type.User > && network.getTrafficType() =3D=3D TrafficType.Guest > && isLastNicInSubnet(nic) > && network.getGuestType() =3D=3D GuestType.Shared > &&=20 >_networkModel.areServicesSupportedInNetwork(network.getId(),Service.Dhcp)) >{ > //2) Now get the DHCP provider, and do the rest of the checks > DhcpServiceProvider dhcpServiceProvider =3D >getDhcpServiceProvider(network); > if (dhcpServiceProvider !=3D null > && isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) { > removeDhcpServiceInSubnet(nic); > } >} > > >On Fri, Feb 7, 2014 at 8:30 PM, Daan Hoogland >wrote: >> sure, will try to find a spot asap. and write unit tests to simulate >> those two situations. >> >> On Fri, Feb 7, 2014 at 7:20 PM, Alena Prokharchyk >> wrote: >>> Daan, >>> >>> Here is how it should look: >>> >>> //1) Make all the checks that used to exist in original code + if DHCP >>> service is enabled on the network >>> if (vm.getType() =3D=3D Type.User && network.getTrafficType() =3D=3D >>> TrafficType.Guest && isLastNicInSubnet(nic) && network.getGuestType() >>>=3D=3D >>> GuestType.Shared && >>>=20 >>>_networkModel.areServicesSupportedInNetwork(network.getId(),Service.Dhcp >>>)) >>> { >>> >>> //2) Now get the DHCP provider, and do the rest of the checks >>> DhcpServiceProvider dhcpServiceProvider =3D >>> getDhcpServiceProvider(network); >>> if (dhcpServiceProvider !=3D null && >>> isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider)) { >>> removeDhcpServiceInSubnet(nic); >>> } >>> } >>> >>> >>> >>> Could you please test it for 2 Shared networks - one with DHCP service, >>> and one w/o? >>> >>> Thank you! >>> Alena. >>> >>> >>> >>> On 2/7/14, 10:04 AM, "Daan Hoogland" wrote: >>> >>>>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() =3D=3D Type.User >>>> && >>>>_networkModel.areServicesSupportedInNetwork(network.getId(), >>>>Service.Dhcp) >>>> && network.getTrafficType() =3D=3D TrafficType.Guest >>>> && network.getGuestType() =3D=3D GuestType.Shared) { >>>> // remove the dhcpservice ip if this is the last nic in >>>>subnet. >>>> DhcpServiceProvider dhcpServiceProvider =3D >>>>getDhcpServiceProvider(network); >>>> if (dhcpServiceProvider !=3D null >>>> && >>>>isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider) >>>> && isLastNicInSubnet(nic)) { >>>> removeDhcpServiceInSubnet(nic); >>>> } >>>> } >>>> >>>>What do you sugest? >>>> >>>> if (vm.getType() =3D=3D Type.User >>>> && >>>>_networkModel.areServicesSupportedInNetwork(network.getId(), >>>>Service.Dhcp)) { >>>> // remove the dhcpservice ip if this is the last nic in >>>>subnet. >>>> DhcpServiceProvider dhcpServiceProvider =3D >>>>getDhcpServiceProvider(network); >>>> if (dhcpServiceProvider !=3D null >>>> && >>>>isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider) >>>> && isLastNicInSubnet(nic) >>>> && network.getTrafficType() =3D=3D TrafficType.Guest >>>> && network.getGuestType() =3D=3D GuestType.Shared) { >>>> removeDhcpServiceInSubnet(nic); >>>> } >>>> } >>>> >>>>??? >>>> >>>>On Fri, Feb 7, 2014 at 6:56 PM, Alena Prokharchyk >>>> 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" wrote: >>>>> >>>>>>Alena, >>>>>> >>>>>>The revert didn't apply. Would the folowing do the trick? >>>>>> >>>>>> if (vm.getType() =3D=3D Type.User >>>>>> && network.getTrafficType() =3D=3D TrafficType.Guest >>>>>> && network.getGuestType() =3D=3D GuestType.Shared) { >>>>>> // remove the dhcpservice ip if this is the last nic in >>>>>>subnet. >>>>>> DhcpServiceProvider dhcpServiceProvider =3D >>>>>>getDhcpServiceProvider(network); >>>>>> if (dhcpServiceProvider !=3D null >>>>>> && >>>>>>isDhcpAccrossMultipleSubnetsSupported(dhcpServiceProvider) >>>>>> && isLastNicInSubnet(nic)) { >>>>>> removeDhcpServiceInSubnet(nic); >>>>>> } >>>>>> } >>>>>> >>>>>>On Fri, Feb 7, 2014 at 6:55 AM, Daan Hoogland >>>>>> >>>>>>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 >>>>>>> >>>>>>>wrote: >>>>>>>> will do Alena, >>>>>>>> >>>>>>>> thanks for the headsup >>>>>>>> >>>>>>>> On Thu, Feb 6, 2014 at 10:42 PM, Alena Prokharchyk >>>>>>>> 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() =3D=3D Type.User && >>>>>>>>> isDhcpAccrossMultipleSubnetsSupported(network) && >>>>>>>>>isLastNicInSubnet(nic) && >>>>>>>>> network.getTrafficType() =3D=3D TrafficType.Guest >>>>>>>>> >>>>>>>>> With >>>>>>>>> >>>>>>>>> + DhcpServiceProvider dhcpServiceProvider =3D >>>>>>>>> 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 >>> >> >> >> >> -- >> Daan > > > >--=20 >Daan