<div dir="ltr">On Fri, May 31, 2013 at 12:48 AM, Richard W.M. Jones <span dir="ltr"><<a href="mailto:rjones@redhat.com" target="_blank">rjones@redhat.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Thu, May 30, 2013 at 10:21:42PM +0800, Qiu Yu wrote:<br>
> Hi,<br>
><br>
> Following code snippet, running as non-root user, will throw up a<br>
> 'Permission denied' RuntimeError.<br>
><br>
> Could someone kindly guide me the correct way to handle LVM disk as<br>
> non-root user?<br>
><br>
</div><div class="im">> import guestfs<br>
> g = guestfs.GuestFS()<br>
> g.add_drive_opts("/dev/vg0/disk1", format="raw")<br>
<br>
</div>Libguestfs doesn't do anything different from any other program. I'm<br>
assuming that /dev/vg0/disk1 isn't accessible by non-root (by anyone)<br>
on your host.<br>
<br>
On most Linux distros you can add yourself to the 'disk' group<br>
in order to get access to disk devices:<br>
<br>
# usermod -G disk -a yourusername<br>
<br>
You may need to log out and log in again after doing that.<br></blockquote><div><br></div><div style>Unfortunately, the standard 'disk' group permission only applies to /dev/sdX device nodes, not to device mapper nodes created by LVM commands.</div>
<div style><br></div><div style>Thank you for the clarification on libguestfs. I'll try to find out other way to handle LVM device nodes as non-root user.</div><div style><br></div><div style>--</div><div style>Qiu Yu</div>
</div><br></div></div>