From patchwork Fri Nov 21 14:18:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 41322 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 01E9D2452C for ; Fri, 21 Nov 2014 14:21:28 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf3380686wib.10 for ; Fri, 21 Nov 2014 06:21:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:from:to:date :organization:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=AR2Y98ZNEN5roht0yx5odVr8qqiSGsSsUEKVhsnlycE=; b=EEnTbGnbEAnV7iRA8Z0MDSUW/s9iqwIUL1K0w/JD/2UHKsSiW1NN3wZ3AmFcMLvA+t NSn+P7H6TON2qRkf0xepGiIQL+2VWS76yBqXm4Pbn0zUhqGNVEHSZc6YmkzFyFcTowUA IOzOgyegVACNXfKHlbS2XKC8hvXU7WnRJBcjiWJmNjaU5BpI7n3kwS0T6Es/BO7rpwtl Ta90d2bIZn4jKeFSm+2NmPfKAgWqNs1XNOw+E/KadgjZaZAcfLgr7oTLj/J63J7jtQY7 VQdiBDdz7fi4fVPUygVnydK2XbfW7fC2+Lk4jgHxLFQAZgqZnZpidBqjari27fkPqVcQ 6jJg== X-Gm-Message-State: ALoCoQkASgInV11BGTlSR1GXx9JqS0EGNWs2RMudVLQaaQQ5K692QndP5dbzhi3/VRyyIInGDS/+ X-Received: by 10.180.85.97 with SMTP id g1mr9326374wiz.0.1416579685250; Fri, 21 Nov 2014 06:21:25 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.1 with SMTP id bc1ls210584lab.24.gmail; Fri, 21 Nov 2014 06:21:25 -0800 (PST) X-Received: by 10.112.184.70 with SMTP id es6mr4875662lbc.85.1416579684987; Fri, 21 Nov 2014 06:21:24 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id c9si5585548lae.69.2014.11.21.06.21.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 06:21:24 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id gm9so1327607lab.26 for ; Fri, 21 Nov 2014 06:21:24 -0800 (PST) X-Received: by 10.152.37.69 with SMTP id w5mr4839247laj.67.1416579684853; Fri, 21 Nov 2014 06:21:24 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp98967lbc; Fri, 21 Nov 2014 06:21:24 -0800 (PST) X-Received: by 10.221.68.199 with SMTP id xz7mr4711883vcb.7.1416579683547; Fri, 21 Nov 2014 06:21:23 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id nu10si2376747vcb.93.2014.11.21.06.21.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 21 Nov 2014 06:21:23 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xrp3b-00037c-2Z; Fri, 21 Nov 2014 14:19:31 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xrp3Z-00037X-FX for xen-devel@lists.xen.org; Fri, 21 Nov 2014 14:19:29 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id DC/CE-26652-0F94F645; Fri, 21 Nov 2014 14:19:28 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1416579567!12664446!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26066 invoked from network); 21 Nov 2014 14:19:28 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 21 Nov 2014 14:19:28 -0000 X-IronPort-AV: E=Sophos;i="5.07,431,1413244800"; d="scan'208";a="193717329" Message-ID: <1416579506.17932.10.camel@citrix.com> From: Ian Campbell To: M A Young , Ian Jackson , Wei Liu , Andrew Cooper Date: Fri, 21 Nov 2014 14:18:26 +0000 Organization: Citrix Systems, Inc. X-Mailer: Evolution 3.12.7-1 MIME-Version: 1.0 X-DLP: MIA2 Cc: xen-devel Subject: [Xen-devel] running pygrub on split-partition disk layouts. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: An absolute age ago Michael posted a patch to allow pygrub to work with split-partition layouts (i.e. those where the guests disk cfg refers to xvda1, xvda2, etc rather than an xvda with a partition table). See http://lists.xen.org/archives/html/xen-devel/2011-01/msg02076.html (patch itself is below). Apparently at the time I was of the opinion that this was a reasonable workaround for the underlying issue (although I seem to have thought I had a better solution, not so sure right now...). I'm not sure why it didn't go in (in the likely event I just dropped the ball -- sorry!). Anyway, this resurfaced recently in the context of Debian bug #745419: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745419#27 #745419 seems to be unrelated to Michael's issue, it is a full disk image case with an MBR etc. Michael, are you still carrying this patch to the Fedora packages? If so presumably it is without issue in the field so to speak? Should the patch be resurrected for either 4.5 or 4.6? Or does anyone have any other insights into the various issues? Ian. --- xen-4.1.0/tools/pygrub/src/pygrub.orig 2010-12-31 15:24:11.000000000 +0000 +++ xen-4.1.0/tools/pygrub/src/pygrub 2011-01-30 18:58:17.000000000 +0000 @@ -96,6 +96,7 @@ fd = os.open(file, os.O_RDONLY) buf = os.read(fd, 512) + offzerocount = 0 for poff in (446, 462, 478, 494): # partition offsets # MBR contains a 16 byte descriptor per partition @@ -105,6 +106,7 @@ # offset == 0 implies this partition is not enabled if offset == 0: + offzerocount += 1 continue if type == FDISK_PART_SOLARIS or type == FDISK_PART_SOLARIS_OLD: @@ -123,6 +125,9 @@ else: part_offs.append(offset) + if offzerocount == 4: + # Might be a grub boot sector pretending to be an MBR + part_offs.append(0) return part_offs class GrubLineEditor(curses.textpad.Textbox):