[virt-tools-list] [virt-manager PATCH 0/1] virtinst: Use sudo where root permission is needed

Cole Robinson crobinso at redhat.com
Thu Sep 14 22:46:53 UTC 2017


On 09/09/2017 11:25 AM, Andrew Wong wrote:
> On 09/09/17 05:29 AM, Pavel Hrdina wrote:
>> On Fri, Sep 08, 2017 at 11:49:47PM -0400, Andrew Wong wrote:
>>> Hello,
>>>
>>> I have a small request that I hope is reasonable. For testing VMs, I like to
>>> install VMs as non-root. However, if I want to install from a location that
>>> requires mounting, then installing becomes a bit of a hassle. I'd have to
>>> manually mount the location with sudo or root, then pass the mount point into
>>> "--location".  It'd be nice of virt-install could elevated to root where
>>> necessary. Basically, something like the attached patch.
>> Hi, thanks for the patch.  This is interesting idea but I'm not sure
>> whether it's a good idea.  You can easily run the whole virt-install
>> command using sudo.

I agree that adding sudo kinda weirds me out. One issue I can think off of the
bat is that sudo can go interactive sometimes. how does this play with
virt-install in scripts, or running virt-manager, with or without the --debug
flag. Might be a simple fix though

But anyways it just feels kinda wrong :) Then again so does the mount
invocations but things have changes a ton since that code was first added.

> Perhaps another option would be to avoid using mount/umount for iso entirely,
> and use something like "isoinfo" to extract the kernel, initrd, and any other
> files. This would probably involve a lot more code changes, and require the
> "isoinfo" command to be available.
> 

I'd like to see something like this instead. In fact it's probably not much
work unless there's hiccups I can't predict. It's basically writing a
_URLFetcher implementation in urlfetcher.py. prepareLocation could cache a
file listing with isoinfo -i $iso -Rf. _hasFile just checks if the patch is in
the cached file list. _grabber does isoinfo -i $iso -R -x $filename and wraps
that content in a StringIO. And a bit of glue in fetcherForURI

Thanks,
Cole




More information about the virt-tools-list mailing list