WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-cim

[Xen-cim] Python script problems, part 1 - domUloader patch

To: <xen-cim@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-cim] Python script problems, part 1 - domUloader patch
From: "Szymanski, Lukasz K" <Lukasz.Szymanski@xxxxxxxxxx>
Date: Tue, 3 Jul 2007 11:18:51 -0400
Delivery-date: Tue, 03 Jul 2007 08:16:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-cim-request@lists.xensource.com?subject=help>
List-id: xen-cim mailing list <xen-cim.lists.xensource.com>
List-post: <mailto:xen-cim@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-cim-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcesbojDbS4fJR48QlimG6n5y/VrCARE/rnQ
Thread-topic: Python script problems, part 1 - domUloader patch
This is the first of several emails I exchanged with Jim wrt some
problems I had running python scripts.  We emailed off list but it makes
sense to bring this onto the list.   

-----Original Message-----
From: Jim Fehlig 
Sent: Monday, June 11, 2007 5:22 PM
To: Szymanski, Lukasz K
Subject: Re: Python script problems

In config.sxp, is see that vbd has '(bootable 0)'.  This implies your
xen is 3.1.0 or greater.  Currently Xen_VirtualSystemManagementService
does not set disk to bootable when creating the vbd.  I guess I should
just set all disks bootable before creating the vbd.  BTW, I now recall
asking about the vbd bootable field on Xen API ml

http://lists.xensource.com/archives/html/xen-api/2007-05/msg00001.html

Never received a response :-(.  Typical of my posts to xen mailing
lists.  Anyway, if you have a config where kernel/ramdisk live on any
disk other than the first, you will need the attached patch for
domUloader to work - in addition to a fix for
Xen_VirtualSystemManagementService that I will commit shortly.

Jim

Szymanski, Lukasz K wrote:
> Attached are xend.log and config.sxp
>
> Thanks,
> Luke
>  
> -----Original Message-----
> From: Jim Fehlig 
> Sent: Monday, June 11, 2007 3:36 PM
> To: Szymanski, Lukasz K
> Subject: Re: Python script problems
>
> Szymanski, Lukasz K wrote:
>   
>> Jim -
>>
>> I have tinkered around with the python script (attached) for awhile 
>> now and have not gotten very far.  Here is the breakdown:
>>
>> - The create works, but the start fails (see disk error below).  The 
>> funny thing is, xm list shows the vm as running.
>> - I can use xm create with the very same disk, and have no problems.
>> - domUloader is missing, but I copied it from somewhere and it 
>> supposedly works
>> - This exact script USED to work.
>>
>> Any suggestions are greatly appreciated.
>>
>>     
>
> What is output to xend.log when start is invoked?  The contents of 
> /var/lib/xend/domains/<dom_uuid>/config.sxp would be useful also.
>
>   
>> Also, do you have any python scripts where you use embedded
instances?
>>
>>     
>
> Attached is an example.
>
> Jim
>
>   
Index: xen-3.1-testing/tools/python/xen/xend/XendBootloader.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendBootloader.py
+++ xen-3.1-testing/tools/python/xen/xend/XendBootloader.py
@@ -14,6 +14,7 @@
 
 import os, select, errno, stat, signal
 import random
+import re
 import shlex
 from xen.xend import sxp
 
@@ -187,3 +188,14 @@ def bootloader_tidy(dom):
         os.kill(pid, signal.SIGKILL)
 
 
+def bootfilter(bootloader, bootloader_args, vdisk):
+    """Is this virtual disk ok to boot from?"""
+    if vdisk.endswith(':disk'):
+        vdisk = vdisk[:-5]  # temporary work-around for bug 237414
+    if bootloader.endswith('domUloader.py'):
+        for arg in bootloader_args.split():
+            if arg.startswith('--entry='):
+                m = re.match(r'^([hsx]v?d[a-z])[0-9]*:[^,]*(,[^,]*)?$', 
arg[8:])
+                if m:
+                    return vdisk == m.group(1) or vdisk == m.group(2)
+    return True
Index: xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
===================================================================
--- xen-3.1-testing.orig/tools/python/xen/xend/XendDomainInfo.py
+++ xen-3.1-testing/tools/python/xen/xend/XendDomainInfo.py
@@ -42,7 +42,7 @@ from xen.xend import balloon, sxp, uuid,
 from xen.xend import XendOptions, XendNode, XendConfig
 
 from xen.xend.XendConfig import scrub_password
-from xen.xend.XendBootloader import bootloader, bootloader_tidy
+from xen.xend.XendBootloader import bootloader, bootloader_tidy, bootfilter
 from xen.xend.XendError import XendError, VmError
 from xen.xend.XendDevices import XendDevices
 from xen.xend.XendTask import XendTask
@@ -1783,8 +1783,11 @@ class XendDomainInfo:
                 blexec = osdep.pygrub_path
 
             blcfg = None
-            disks = [x for x in self.info['vbd_refs']
-                     if self.info['devices'][x][1]['bootable']]
+            disks = []
+            for x in self.info['vbd_refs']:
+                vdisk = self.info['devices'][x][1]['dev']
+                if bootfilter(blexec, bootloader_args, vdisk):
+                    disks.append(x)
 
             if not disks:
                 msg = "Had a bootloader specified, but no disks are bootable"
_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-cim] Python script problems, part 1 - domUloader patch, Szymanski, Lukasz K <=