[virt-tools-list] [virt-install PATCH 2/7] virtinst: cli: Introduce parser support for SEV launch security

Erik Skultety eskultet at redhat.com
Tue Jun 11 14:55:23 UTC 2019


On Thu, Jun 06, 2019 at 04:26:27PM -0400, Cole Robinson wrote:
> On 6/6/19 6:00 AM, Erik Skultety wrote:
> > Introduce both the launchSecurity XML and parser classes. While at it,
> > add launchSecurity as a property instance to the Guest class too.
> >
> > The parser requires the 'type' argument to be mandatory since in the
> > future it will determine different code paths, therefore
> > '--launch-security foo=bar' is incorrect.
> >
>
...

>
>
> > +    def _check_required_opts(self):
> > +        type_ = self.optdict.get("type", None)
> > +
> > +        if not type_:
> > +            fail(_("Missing mandatory attribute 'type' for --launch-security"))
> > +
>
> Generally we don't want this style of validation in the cli parser
> because it's tricky to get right. In this case it will break using
> virt-xml to edit a single non-type --launchSecurity field which should
> be a valid thing to do.
>
> You'll want to move this validation into a 'def validate' function in
> the launch security object and the virt-install cli parser will call it
> by default.

I have the patches ready, but the validate method doesn't seem to be invoked
when I run virt-install without the @type manually. What ensures that the
validate method is called automatically? The strange thing is that I
have an invalid test for this and it does fail.

Erik




More information about the virt-tools-list mailing list