Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 May 2023 21:40:04 +0300
From:      Vitaliy Gusev <gusev.vitaliy@gmail.com>
To:        Mario Marietto <marietto2008@gmail.com>
Cc:        Tomek CEDRO <tomek@cedro.info>, virtualization@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: BHYVE SNAPSHOT image format proposal
Message-ID:  <D243949C-4C2E-4C6E-8961-7534DD2CCD00@gmail.com>
In-Reply-To: <CA%2B1FSijKkCnR5j1N9BN0CbqzzitibK7r9OA84jc2eZ=uJaMW-g@mail.gmail.com>
References:  <67FDC8A8-86A6-4AE4-85F0-FF7BEF9F2F06@gmail.com> <CAFYkXjng1LWy5wVyTnSo0xrEWOy%2BOx9ZjLcmFqQs5EVpT8J_uA@mail.gmail.com> <AF34E648-2D8A-46C7-82A5-B88006BBB8F6@gmail.com> <CAFYkXjkUjh8gEMv4XZgb2QQW=qM1fhxMoMxRYuc4p6HbBXsDCw@mail.gmail.com> <8FE14143-1AA9-418E-A497-FEFB99BF6B9F@gmail.com> <CA%2B1FSijKkCnR5j1N9BN0CbqzzitibK7r9OA84jc2eZ=uJaMW-g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_9EC57A81-2637-440C-A2F4-5E1697C8811A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On 25 May 2023, at 19:22, Mario Marietto <marietto2008@gmail.com> =
wrote:
>=20
> Vitaliy,
>=20
> what happens if I clone your repo as source code on my FreeBSD system. =
Can I test your code directly or not ? Anyway,I think that,before doing =
this,I need to follow some kind of tutorial,to understand how the =
workflow is. Otherwise I will be not able to test and stress it.=20


You should build kernel and tools, install it. Then you can run bhyve, =
bhyvectl to deal with suspend/resume.

Please follow=20

 9.5. Building and Installing a Custom Kernel

https://docs.freebsd.org/en/books/handbook/book/#kernelconfig-building


Make sure that BHYVE_SNAPSHOT is enabled.

Also look at build(7):

https://man.freebsd.org/cgi/man.cgi?build(7)


>=20
> On Thu, May 25, 2023 at 3:40=E2=80=AFPM Vitaliy Gusev =
<gusev.vitaliy@gmail.com <mailto:gusev.vitaliy@gmail.com>> wrote:
>>=20
>>=20
>>> On 25 May 2023, at 04:30, Tomek CEDRO <tomek@cedro.info =
<mailto:tomek@cedro.info>> wrote:
>>>=20
>>> On Wed, May 24, 2023 at 5:11=E2=80=AFPM Vitaliy Gusev wrote:
>>>> Protecting requires more efforts and it should be clearly defined: =
what is purpose. If
>>>> purpose is having checksum with 99.9% reliability, NVLIST HEADER =
can be widen
>>>> to have =E2=80=9Cchecksum=E2=80=9D key/value for a Section.
>>>=20
>>> Well, this could be optional but useful to make sure snapshot did =
not
>>> break somehow for instance backup medium error or something like
>>> that.. even more maybe a way to fix it.. just a design stage idea :-
>>=20
>> Yes, new format can have checksum of a Section data if implemented.
>>=20
>>>=20
>>>=20
>>>> If purpose is having crypto verification - I believe sha256 program =
should be your choice.
>>>=20
>>> My question was more specific to availability of that feature
>>> (integrity + repair) rather than specific format :-)
>>>=20
>>> The use case here is having a virtual machine (it was VirtualBox) =
with
>>> a bare os installed, plus some common applications, that is =
snapshoted
>>> at some point in time, then experimented a lot, restored from
>>> snapshot, etc. I had a backup of such vm + snapshot backed up that =
got
>>> broken somehow. It would be nice to know that something is broken,
>>> what is broken, maybe a way to fix :-)
>>=20
>>=20
>>  =E2=80=9CIntegrity" is a very broad term. What checksum algorithm is =
fine enough?
>> =20
>> For the instance,  ZFS has several options for checksum:
>>=20
>> =
checksum=3Don|off|fletcher2|fletcher4|sha256|noparity|sha512|skein|edonr
>>       =20
>>=20
>> Having checksum for a filesystem is strongly recommended. However, If =
consider image format,
>> it  doesn=E2=80=99t need to care about consistency in a file itself. =
As example (!)  - binary files in a system.
>> They don=E2=80=99t have checksum integrated, validation is done by =
another program  - pkg or another.
>>=20
>>=20
>>>=20
>>>=20
>>>> Why do you need modify snapshot image ? Could you describe more? Do =
you
>>>> modify current 3 snapshot files?
>>>=20
>>> Analysis that require ram / nvram modification? Not sure if this is
>>> already possible, but may come handy for experimenting with uefi and
>>> maybe some OS (features) that will not run with unmodified nvram :-P
>>=20
>>=20
>> Sorry I don=E2=80=99t get, why do you need to modify snapshot image, =
but not directly vmem on the running
>> VM?
>>=20
>> Another question, checksum and modifying image - two mutual exclusive =
things.=20
>>=20
>>>=20
>>>=20
>>>> If you are talking about compatibility of a Image format - it =
should be compatible in
>>>> both directions, at least for not so big format changes.
>>>>=20
>>>> If consider overall snapshot/resume compatibility - I believe  =
forward compatibility
>>>> is not case and target. Indeed, why do you need  to resume an image =
created by
>>>> a higher version of a program?
>>>=20
>>> This happens quite often. For instance there is a bug in application
>>> and I need to revert to (at least) one step older version. Then I am
>>> unable to work on a file that I just saved (or was autosaved for =
me).
>>> Firefox profile settings let be the first example. KiCAD file format
>>> is another example (sometimes I need to switch to a devel build to
>>> evade a nasty blocker bug then anyone else that uses a release is
>>> blocked for some months including me myself).
>>=20
>> Any additional thing has a cost of development, testing and support. =
Current
>> Implementation doesn=E2=80=99t support compatibility at all. Having =
compatibility in both
>> directions can be hard.
>>=20
>> For example, if some variable is removed in bhyve, backward =
compatibility is fine,
>> but forward compatibly is not possible unless that removed variable =
is being saved
>> into a snapshot image just for forward compatibility. And of course, =
it should be tested
>> and verified as worked.
>>=20
>> Do you like that approach? I don=E2=80=99t think so. So I guess only =
backward compatibility
>> should be supported to make the snapshot code simple and robust.
>>=20
>> Thanks,
>> Vitaliy Gusev
>>=20
>>=20
>=20
>=20
> --=20
> Mario.


--Apple-Mail=_9EC57A81-2637-440C-A2F4-5E1697C8811A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><br><blockquote type=3D"cite"><div>On 25 =
May 2023, at 19:22, Mario Marietto &lt;marietto2008@gmail.com&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div><div =
dir=3D"ltr"><div>Vitaliy,</div><div><br></div><div>what happens if I =
clone your repo as source code on my FreeBSD system. Can I test your =
code directly or not ? Anyway,I think that,before doing this,I need to =
follow some kind of tutorial,to understand how the workflow is. =
Otherwise I will be not able to test and stress it. =
<br></div></div></div></blockquote><div><br></div><div><br></div>You =
should build kernel and tools, install it. Then you can run bhyve, =
bhyvectl to deal with suspend/resume.</div><div><br></div><div>Please =
follow&nbsp;</div><div><br></div><div>&nbsp;<span style=3D"caret-color: =
rgb(68, 68, 68); color: rgb(68, 68, 68); font-family: &quot;inter =
var&quot;, -apple-system, BlinkMacSystemFont, &quot;avenir next&quot;, =
avenir, &quot;segoe ui&quot;, &quot;helvetica neue&quot;, helvetica, =
Cantarell, Ubuntu, roboto, noto, arial, sans-serif; font-size: =
var(--size-550);"><b>9.5. Building and Installing a Custom =
Kernel</b></span></div><div><br></div><div><a =
href=3D"https://docs.freebsd.org/en/books/handbook/book/#kernelconfig-buil=
ding">https://docs.freebsd.org/en/books/handbook/book/#kernelconfig-buildi=
ng</a><br></div><div><br></div><div><br></div><div>Make sure that =
BHYVE_SNAPSHOT is enabled.</div><div><br></div><div>Also look at =
build(7):</div><div><br></div><div><a =
href=3D"https://man.freebsd.org/cgi/man.cgi?build(7)">https://man.freebsd.=
org/cgi/man.cgi?build(7)</a></div><div><br></div><div><br><blockquote =
type=3D"cite"><div><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Thu, May 25, 2023 at 3:40=E2=80=AFPM Vitaliy =
Gusev &lt;<a =
href=3D"mailto:gusev.vitaliy@gmail.com">gusev.vitaliy@gmail.com</a>&gt; =
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid =
rgb(204,204,204);padding-left:1ex"><div><br><div><br><blockquote =
type=3D"cite"><div>On 25 May 2023, at 04:30, Tomek CEDRO &lt;<a =
href=3D"mailto:tomek@cedro.info" =
target=3D"_blank">tomek@cedro.info</a>&gt; wrote:</div><br><div><div>On =
Wed, May 24, 2023 at 5:11=E2=80=AFPM Vitaliy Gusev wrote:<br><blockquote =
type=3D"cite">Protecting requires more efforts and it should be clearly =
defined: what is purpose. If<br>purpose is having checksum with 99.9% =
reliability, NVLIST HEADER can be widen<br>to have =E2=80=9Cchecksum=E2=80=
=9D key/value for a Section.<br></blockquote><br>Well, this could be =
optional but useful to make sure snapshot did not<br>break somehow for =
instance backup medium error or something like<br>that.. even more maybe =
a way to fix it.. just a design stage idea =
:-</div></div></blockquote><br>Yes, new format can have checksum of a =
Section data if implemented.</div><div><br><blockquote =
type=3D"cite"><div><div><br><br><blockquote type=3D"cite">If purpose is =
having crypto verification - I believe sha256 program should be your =
choice.<br></blockquote><br>My question was more specific to =
availability of that feature<br>(integrity + repair) rather than =
specific format :-)<br><br>The use case here is having a virtual machine =
(it was VirtualBox) with<br>a bare os installed, plus some common =
applications, that is snapshoted<br>at some point in time, then =
experimented a lot, restored from<br>snapshot, etc. I had a backup of =
such vm + snapshot backed up that got<br>broken somehow. It would be =
nice to know that something is broken,<br>what is broken, maybe a way to =
fix =
:-)<br></div></div></blockquote><div><br></div><div><br></div><div>&nbsp;=E2=
=80=9CIntegrity" is a very broad term. What checksum algorithm is fine =
enough?</div><div>&nbsp;</div><div>For the instance, &nbsp;ZFS has =
several options for checksum:</div><div><br></div></div><blockquote =
style=3D"margin:0px 0px 0px 40px;border:medium =
none;padding:0px"><div><div><div style=3D"margin: 0px; font-style: =
normal; font-variant-caps: normal; font-stretch: normal; font-size: =
12px; line-height: normal; font-family: Menlo; font-size-adjust: none; =
font-kerning: auto; font-variant-alternates: normal; =
font-variant-ligatures: normal; font-variant-numeric: normal; =
font-variant-east-asian: normal; font-feature-settings: normal; =
background-color: rgb(231, 238, 238);"><span =
style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(231,238,238)=
;background-color:rgb(0,0,0)"><b>checksum</b></span><span =
style=3D"font-variant-ligatures:no-common-ligatures">=3D<b>on</b>|<b>off</=
b>|<b>fletcher2</b>|<b>fletcher4</b>|<b>sha256</b>|<b>noparity</b>|<b>sha5=
12</b>|<b>skein</b>|<b>edonr</b></span></div></div></div><div><div><p =
style=3D"margin:0px;font-style:normal;font-variant-caps:normal;font-stretc=
h:normal;font-size:12px;line-height:normal;font-family:Menlo;font-size-adj=
ust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-lig=
atures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;f=
ont-feature-settings:normal;background-color:rgb(231,238,238)"><span =
style=3D"font-variant-ligatures:no-common-ligatures">&nbsp; &nbsp; =
&nbsp; =
&nbsp;</span></p></div></div></blockquote><div><br></div><div>Having =
checksum for a filesystem is strongly recommended. However, If consider =
image format,</div><div>it &nbsp;doesn=E2=80=99t need to care about =
consistency in a file itself. As example (!) &nbsp;- binary files in a =
system.</div><div>They don=E2=80=99t have checksum integrated, =
validation is done by another program &nbsp;- pkg or =
another.</div><div><br></div><div><br></div><div><blockquote =
type=3D"cite"><div><div><br><br><blockquote type=3D"cite">Why do you =
need modify snapshot image ? Could you describe more? Do you<br>modify =
current 3 snapshot files?<br></blockquote><br>Analysis that require ram =
/ nvram modification? Not sure if this is<br>already possible, but may =
come handy for experimenting with uefi and<br>maybe some OS (features) =
that will not run with unmodified nvram =
:-P<br></div></div></blockquote><div><br></div><div><br></div>Sorry I =
don=E2=80=99t get, why do you need to modify snapshot image, but not =
directly vmem on the =
running</div><div>VM?</div><div><br></div><div>Another question, =
checksum and modifying image - two mutual exclusive =
things.&nbsp;</div><div><br><blockquote =
type=3D"cite"><div><div><br><br><blockquote type=3D"cite">If you are =
talking about compatibility of a Image format - it should be compatible =
in<br>both directions, at least for not so big format changes.<br><br>If =
consider overall snapshot/resume compatibility - I believe &nbsp;forward =
compatibility<br>is not case and target. Indeed, why do you need =
&nbsp;to resume an image created by<br>a higher version of a =
program?<br></blockquote><br>This happens quite often. For instance =
there is a bug in application<br>and I need to revert to (at least) one =
step older version. Then I am<br>unable to work on a file that I just =
saved (or was autosaved for me).<br>Firefox profile settings let be the =
first example. KiCAD file format<br>is another example (sometimes I need =
to switch to a devel build to<br>evade a nasty blocker bug then anyone =
else that uses a release is<br>blocked for some months including me =
myself).<br></div></div></blockquote><div><br></div><div>Any additional =
thing has a cost of development, testing and support. =
Current</div><div>Implementation doesn=E2=80=99t support compatibility =
at all. Having compatibility in both</div><div>directions can be =
hard.</div><div><br></div><div>For example, if some variable is removed =
in bhyve, backward compatibility is fine,</div><div>but forward =
compatibly is not possible unless that removed variable is being =
saved</div><div>into a snapshot image just for forward compatibility. =
And of course, it should be tested</div><div>and verified as =
worked.</div><div><br></div><div>Do you like that approach? I don=E2=80=99=
t think so. So I guess only backward compatibility</div><div>should be =
supported to make the snapshot code simple and =
robust.</div><div><br></div></div><div>Thanks,</div><div>Vitaliy =
Gusev</div><div><br></div><div><br></div></div></blockquote></div><br =
clear=3D"all"><br><span class=3D"gmail_signature_prefix">-- =
</span><br><div dir=3D"ltr" class=3D"gmail_signature">Mario.<br></div>
</div></blockquote></div><br></body></html>=

--Apple-Mail=_9EC57A81-2637-440C-A2F4-5E1697C8811A--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D243949C-4C2E-4C6E-8961-7534DD2CCD00>