[virt-tools-list] [virt-manager PATCH] virt-install: enable container to use "--boot init=INITPATH"

Cole Robinson crobinso at redhat.com
Wed Jan 29 21:31:51 UTC 2014


On 01/29/2014 10:21 AM, Chen Hanxiao wrote:
> At 2014-01-29 21:58:09,"Cole Robinson" <crobinso at redhat.com> wrote:
> 
>>On 01/29/2014 05:16 AM, Chen Hanxiao wrote:
>>> From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
>>> 
>>> If we use "--boot init=INITPATH" style to set
>>> container's init, virt-install will complain:
>>> 
>>> "ERROR    Install methods (--location URL,
>>> --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)
>>> cannot be specified for container guests"
>>> 
>>> This patch will fix this bug.
>>> 
>>> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
>>> ---
>>>  virt-install | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/virt-install b/virt-install
>>> index ca78d1e..835d445 100755
>>> --- a/virt-install
>>> +++ b/virt-install
>>> @@ -477,7 +477,8 @@ def build_installer(options, conn, virt_type):
>>>      elif options.import_install or options.boot:
>>>          if options.import_install and options.nodisks:
>>>              fail(_("A disk device must be specified with --import."))
>>> -        options.import_install = True
>>> +        if options.boot and not options.boot.startswith("init="):
>>> +            options.import_install = True
>>>          instclass = virtinst.ImportInstaller
>>>      elif virt_type == "exe":
>>>          instclass = virtinst.ContainerInstaller
>>> 
>>
>>That boot check isn't sufficient, since someone could do --boot
>>OPT=VAL,init=... and the check wouldn't catch it.
>>
>>What's the command line that's breaking here? We should add a test case for
>>it. And maybe there's another way to solve it, like moving the virt_type ==
>>"exe" check up or similar.
>>
> 
> Use commnd from examples in man page, but replace --init to --boot init=INIPATH
> 
> virt-install  --connect lxc:///  --name httpd_guest   --memory 512   --vcpus 2   --boot init=/usr/bin/httpd
> 

I think just moving the ContainerInstaller check above the --boot check should
fix it.

- Cole




More information about the virt-tools-list mailing list