cli: Fix --security label=foo,unknownopt=val

We should embed the unknown opt
This commit is contained in:
Cole Robinson 2014-01-24 18:07:45 -05:00
parent 65124ff66b
commit cf626c3afe
3 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@
</rng> </rng>
</devices> </devices>
+ <seclabel relabel="yes"> + <seclabel relabel="yes">
+ <label>foo,bar,baz</label> + <label>foo,bar,baz,UNKNOWN=val</label>
+ </seclabel> + </seclabel>
</domain> </domain>

View File

@ -763,7 +763,7 @@ c.add_compare("--vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1", "virtxml-edi
c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "virtxml-edit-simple-cpu") c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "virtxml-edit-simple-cpu")
c.add_compare("--numatune 1-5,7,mode=strict", "virtxml-edit-simple-numatune") c.add_compare("--numatune 1-5,7,mode=strict", "virtxml-edit-simple-numatune")
c.add_compare("--boot loader=foo.bar,network,useserial=on,init=/bin/bash", "virtxml-edit-simple-boot") c.add_compare("--boot loader=foo.bar,network,useserial=on,init=/bin/bash", "virtxml-edit-simple-boot")
c.add_compare("--security label=foo,bar,baz,relabel=on", "virtxml-edit-simple-security") c.add_compare("--security label=foo,bar,baz,UNKNOWN=val,relabel=on", "virtxml-edit-simple-security")
c.add_compare("--features eoi=on,hyperv_relaxed=off,acpi=", "virtxml-edit-simple-features") c.add_compare("--features eoi=on,hyperv_relaxed=off,acpi=", "virtxml-edit-simple-features")
c.add_compare("--clock offset=localtime,hpet_present=yes,kvmclock_present=no,rtc_tickpolicy=merge", "virtxml-edit-simple-clock") c.add_compare("--clock offset=localtime,hpet_present=yes,kvmclock_present=no,rtc_tickpolicy=merge", "virtxml-edit-simple-clock")
c.add_compare("--disk /dev/zero,perms=ro,startup_policy=optional", "virtxml-edit-simple-disk") c.add_compare("--disk /dev/zero,perms=ro,startup_policy=optional", "virtxml-edit-simple-disk")

View File

@ -959,7 +959,7 @@ class _VirtCLIArgument(object):
After the parser sees this option, it will iterate over the After the parser sees this option, it will iterate over the
option string until it finds another known argument name: option string until it finds another known argument name:
everything prior to that argument name is considered part of everything prior to that argument name is considered part of
the value of this option. Should be used sparingly. the value of this option, '=' included. Should be used sparingly.
@is_list: This value should be stored as a list, so multiple instances @is_list: This value should be stored as a list, so multiple instances
are appended. are appended.
@is_onoff: The value expected on the cli is on/off or yes/no, convert @is_onoff: The value expected on the cli is on/off or yes/no, convert
@ -1086,7 +1086,9 @@ class VirtOptionString(object):
optlist.append(tuple(commaopt)) optlist.append(tuple(commaopt))
commaopt = None commaopt = None
else: else:
commaopt[1] += "," + (val or cliname) commaopt[1] += "," + cliname
if val:
commaopt[1] += "=" + val
continue continue
if (cliname in virtargmap and virtargmap[cliname].can_comma): if (cliname in virtargmap and virtargmap[cliname].can_comma):