Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 62E50200CC1 for ; Mon, 10 Jul 2017 08:38:45 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 614C1166F12; Mon, 10 Jul 2017 06:38:45 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A7E10166F01 for ; Mon, 10 Jul 2017 08:38:44 +0200 (CEST) Received: (qmail 73267 invoked by uid 500); 10 Jul 2017 06:38:43 -0000 Mailing-List: contact issues-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 issues@cloudstack.apache.org Received: (qmail 73255 invoked by uid 500); 10 Jul 2017 06:38:43 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 73250 invoked by uid 99); 10 Jul 2017 06:38:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2017 06:38:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 796DE183A87 for ; Mon, 10 Jul 2017 06:38:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id yZ8OK_SjtkK6 for ; Mon, 10 Jul 2017 06:38:41 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id B048F626D9 for ; Mon, 10 Jul 2017 06:32:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A027AE0DEA for ; Mon, 10 Jul 2017 06:32:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5498A246A5 for ; Mon, 10 Jul 2017 06:32:00 +0000 (UTC) Date: Mon, 10 Jul 2017 06:32:00 +0000 (UTC) From: "Wei Zhou (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CLOUDSTACK-9787) No error message while change guest vm cidr to a large value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 10 Jul 2017 06:38:45 -0000 [ https://issues.apache.org/jira/browse/CLOUDSTACK-9787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Wei Zhou resolved CLOUDSTACK-9787. ---------------------------------- Resolution: Fixed > No error message while change guest vm cidr to a large value > ------------------------------------------------------------ > > Key: CLOUDSTACK-9787 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9787 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Reporter: Wei Zhou > Assignee: Wei Zhou > > example > 1. create a network with cidr = 10.1.1.32/28 > 2. edit the network and change guest vm cidr to 10.1.1.32/27 > according to server/src/com/cloud/network/NetworkServiceImpl.java > {code} > if (networkCidr != null) { > if (!NetUtils.isNetworkAWithinNetworkB(guestVmCidr, networkCidr)) { > throw new InvalidParameterValueException("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " > + networkCidr); > } > } else { > if (!NetUtils.isNetworkAWithinNetworkB(guestVmCidr, network.getCidr())) { > throw new InvalidParameterValueException("Invalid value of Guest VM CIDR. For IP Reservation, Guest VM CIDR should be a subset of network CIDR : " > + network.getCidr()); > } > } > {code} > this should throw an exception, however it does not. > I added some unit test in utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java > {code} > @Test > public void testIsNetworkAWithinNetworkB() { > assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/24", "192.168.30.0/23")); > assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/24", "192.168.30.0/22")); > assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/23", "192.168.30.0/24")); > assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/22", "192.168.30.0/24")); > assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/24", "192.168.28.0/23")); > assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/24", "192.168.28.0/22")); > assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/23", "192.168.28.0/24")); > assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.28.0/22", "192.168.28.0/24")); > assertTrue(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/24", "192.168.28.0/22")); > } > {code} > the test fails at > assertFalse(NetUtils.isNetworkAWithinNetworkB("192.168.30.0/23", "192.168.30.0/24")); -- This message was sent by Atlassian JIRA (v6.4.14#64029)