From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v1] dpdk-devbind.py: Virtio interface issue. Date: Fri, 26 Aug 2016 08:55:00 -0700 Message-ID: <20160826085500.5691e07d@xeon-e3> References: <20160825022546.96468-1-sodey@sonusnet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: , To: souvikdey33 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) In-Reply-To: <20160825022546.96468-1-sodey@sonusnet.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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.