<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><span style="font-size: 10pt;">I use python-guestfs to mount windows image it have some problems .Here is my code:</span><br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt"><br>
[root@mfsdata1 ~]# python<br>
Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23) <br>
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> import os<br>
>>> sheepfs_dir="/tmp/sheepfs"<br>
>>> os.system("umount " + sheepfs_dir)<br>
0<br>
>>> os.system("sheepfs -n " + sheepfs_dir)<br>
0<br>
>>> vdi_name = "vm1935028.nbregion.ec2.cloudkc.cn"<br>
>>> os.system("echo " + vdi_name + ">" + sheepfs_dir + "/vdi/mount")<br>
0<br>
>>> import guestfs<br>
>>> g=guestfs.GuestFS()<br>
>>> imgfile=sheepfs_dir + "/volume/" + vdi_name<br>
>>> g.add_drive_opts(imgfile, format="raw", readonly=0)<br>
>>> g.launch()<br>
>>> root = g.inspect_os()<br>
>>> print root<br>
[]<br>
>>> g.list_filesystems()<br>
[('/dev/vda1', 'ntfs'), ('/dev/vda2', 'ntfs')]<br>
</div>
</div>
</div>
</div>
</body>
</html>