From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f180.google.com (mail-pf0-f180.google.com [209.85.192.180]) by dpdk.org (Postfix) with ESMTP id 396A29E3 for ; Fri, 26 Aug 2016 17:54:48 +0200 (CEST) Received: by mail-pf0-f180.google.com with SMTP id y134so29853427pfg.0 for ; Fri, 26 Aug 2016 08:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0AbA1WtuCVK5bhk9VAdqRx+AeEScHcVrW6TpM1I95Ak=; b=Q52yOoS9qvHXJslOvwHgprlhR/VTfAIh7HMCSuFpghEUTLiMynBDqVASUH/sGO75uK D8rjYOzkqsV7alumhjgsWmuak2U8Z62Jb3Zks50cL4+nefmfvQ40FvyZt490mv8XKf3t UxRBUKn1Ll2Onygg2gG7rkm7202JH8nc3SiuNz2T+sWCDlDWfBcW3zJLtpdHH7CZGs5M ya6jTje1o3bYmazOUjb5D6AHurSCpQh2aHneZ6H44vYF95SdQvVFfwboIKeEpxUdURB8 OAs6qpRDIXFQmbmOjQyRCz7EkVTl1KVq6IVB6TweEk0mtQ6iue2o2VQm8MGn9871F8g/ WD6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0AbA1WtuCVK5bhk9VAdqRx+AeEScHcVrW6TpM1I95Ak=; b=cP37v4ldJaRly8guwvUactolgCZ4dt6TMIhkq26L5BWpXCPKwxTNPNgPk7axCsAr8u 6PFmUbzHwkMwmgVsZk7Yj2CMu5RaPoqsdzwvJSqWozW/6LqeGhoqGcvdNT8m5f9jzQF2 bONc4cI4qbtGZkneaEs3TB3aRHDEn9xT1kAgWDq+VT9IKZigF7x/a9hiTZwHfhZEZNk/ rd/R8qS2JYZg+R/pv58HAuD97sLMv53sd+3x60nVi1MPdrje/cYp13EPyMVNr51gPPGh vG4XI1CIS4y0Juan5us4+3xo3ur3fQ7UPMYI0rAolxfykGKMKWXU5/4p0Nin2IfHtri+ BLXg== X-Gm-Message-State: AE9vXwNIx3t4ShDWYfQc0YLV0M2nx4u4OG/eT27MERdPzf6N9SgFEjz8PXJeVTp8CwFIiA== X-Received: by 10.98.13.157 with SMTP id 29mr7190636pfn.105.1472226887589; Fri, 26 Aug 2016 08:54:47 -0700 (PDT) Received: from xeon-e3 (static-50-53-69-251.bvtn.or.frontiernet.net. [50.53.69.251]) by smtp.gmail.com with ESMTPSA id f12sm29775830pfj.31.2016.08.26.08.54.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Aug 2016 08:54:47 -0700 (PDT) Date: Fri, 26 Aug 2016 08:55:00 -0700 From: Stephen Hemminger To: souvikdey33 Cc: , Message-ID: <20160826085500.5691e07d@xeon-e3> In-Reply-To: <20160825022546.96468-1-sodey@sonusnet.com> References: <20160825022546.96468-1-sodey@sonusnet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1] dpdk-devbind.py: Virtio interface issue. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 15:54:48 -0000 On Wed, 24 Aug 2016 22:25:46 -0400 souvikdey33 wrote: > + #The path for virtio devices are different. Get the correct path. > + virtio = "/sys/bus/pci/devices/%s/" % dev_id > + cmd = " ls %s | grep 'virt' " %virtio > + virtio = commands.getoutput(cmd) > + virtio_sys_path = "/sys/bus/pci/devices/%s/%s/net/" % (dev_id,virtio) > if exists(sys_path): > device["Interface"] = ",".join(os.listdir(sys_path)) There should be a way to do this in python without going out to shell. This would be safer and more secure. The code already uses os.listdir() (which is the python library version of ls) in later section. Why not use that here to check for virtio bus.