<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 5, 2016 at 10:05 AM, Nir Soffer <span dir="ltr">&lt;<a href="mailto:nsoffer@redhat.com" target="_blank">nsoffer@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, Dec 4, 2016 at 8:50 PM, Shmuel Melamud &lt;<a href="mailto:smelamud@redhat.com">smelamud@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi!<br>
&gt;<br>
&gt; I&#39;m currently working on integration of virt-sysprep into oVirt.<br>
&gt;<br>
&gt; Usually, if user creates a template from a regular VM, and then creates new VMs from this template, these new VMs inherit all configuration of the original VM, including SSH keys, UDEV rules, MAC addresses, system ID, hostname etc. It is unfortunate, because you cannot have two network devices with the same MAC address in the same network, for example.<br>
&gt;<br>
&gt; To avoid this, user must clean all machine-specific configuration from the original VM before creating a template from it. You can do this manually, but there is virt-sysprep utility that does this automatically.<br>
&gt;<br>
&gt; Ideally, virt-sysprep should be seamlessly integrated into template creation process. But the first step is to create a simple button: user selects a VM, clicks the button and oVirt executes virt-sysprep on the VM.<br>
&gt;<br>
&gt; virt-sysprep works directly on VM&#39;s filesystem. It accepts list of all disks of the VM as parameters:<br>
&gt;<br>
&gt; virt-sysprep -a disk1.img -a disk2.img -a disk3.img<br>
&gt;<br>
&gt; The architecture is as follows: command on the Engine side runs a job on VDSM side and tracks its success/failure. The job on VDSM side runs virt-sysprep.<br>
&gt;<br>
&gt; The question is how to implement the job correctly?<br>
&gt;<br>
&gt; I thought about using storage jobs, but they are designed to work only with a single volume, correct?<br>
<br>
</span>New storage verbs are volume based. This make it easy to manage<br>
them on the engine side, and will allow parallelizing volume operations<br>
on single or multiple hosts.<br>
<br>
A storage volume job is using sanlock lease on the modified volume<br>
and volume generation number. If a host running pending jobs becomes<br>
non-responsive and cannot be fenced, we can detect the state of<br>
the job, fence the job, and start the job on another host.<br>
<br>
In the SPM task, if a host becomes non-responsive and cannot be<br>
fenced, the whole setup is stuck, there is no way to perform any<br>
storage operation.<br>
<span class=""><br>
&gt; Is is possible to use them with operation that is performed on multiple volumes?<br>
&gt; Or, alternatively, is it possible to use some kind of &#39;VM jobs&#39; - that work on VM at whole?<br>
<br>
</span>We can do:<br>
<br>
1. Add jobs with multiple volumes leases - can make error handling very<br>
    complex. How do tell a job state if you have multiple leases? which<br>
    volume generation you use?<br>
<br>
2. Use volume job using one of the volumes (the boot volume?). This does<br>
    not protect the other volumes from modification but engine is responsible<br>
    for this.<br>
<br>
3. Use new &quot;vm jobs&quot;, using a vm lease (should be available this week<br>
on master).<br>
    This protects a vm during sysprep from starting the vm.<br>
    We still need a generation to detect the job state, I think we can<br>
use the sanlock<br>
    lease generation for this.<br>
<br>
I like the last option since sysprep is much like running a vm.<br>
<span class=""><br>
&gt; How v2v solves this problem?<br>
<br>
</span>It does not.<br>
<br>
v2v predates storage volume jobs. It does not use volume leases and generation<br>
and does have any way to recover if a host running v2v becomes non-responsive<br>
and cannot be fenced.<br>
<br>
It also does not use the jobs framework and does not use a thread pool for<br>
v2v jobs, so it has no limit on the number of storage operations on a host.<br>
<span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div><div>Right, but let&#39;s be fair and present the benefits of v2v-jobs as well:</div><div>1. it is the simplest &quot;infrastructure&quot; in terms of LOC</div><div>2. it is the most efficient mechanism in terms of interactions between the engine and VDSM (it doesn&#39;t require new verbs/call, the data is attached to VdsStats; probably the easiest mechanism to convert to events)</div><div>3. it is the most efficient implementation in terms of interaction with the database (no date is persisted into the database, no polling is done)</div><div><br></div><div>Currently we have 3 mechanisms to report jobs:</div><div>1. VM jobs - that is currently used for live-merge. This requires the VM entity to exist in VDSM, thus not suitable for virt-sysprep.</div><div>2. storage jobs - complicated infrastructure, targeted for recovering from failures to maintain storage consistency. Many of the things this infrastructure knows to handle is irrelevant for virt-sysprep flow, and the fact that virt-sysprep is invoked on VM rather than particular disk makes it less suitable.</div><div>3. V2V jobs - no mechanism is provided to resume failed jobs, no leases, etc</div><div><br></div><div>I have some arguments for using V2V-like jobs [1]:</div><div>1. creating template from vm is rarely done - if host goes unresponsive or any other failure is detected we can just remove the template and report the error</div><div>2. the phase of virt-sysprep is, unlike typical storage operation, short - reducing the risk of failures during the process </div><div>3. during the operation the VM is down - by locking the VM/template and its disks on the engine side, we render leases-like mechanism redundant</div><div>4. in the worst case - the disk will not be corrupted (only some of the data might be removed).</div><div><br></div><div>So I think that the mechanism for storage jobs is an over-kill for this case.</div><div>We can keep it simple by generalise the V2V-job for other virt-tools jobs, like virt-sysprep.</div><div><br></div><div>[1] I believe that as Moran and Yaniv noted, we can just do it in the create template flow without the intermediate (POC) stage of having an operation for doing that on existing VM or template - it only complicates stuff</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
Nir<br>
</font></span><div class="HOEnZb"><div class="h5">______________________________<wbr>_________________<br>
Devel mailing list<br>
<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
</div></div></blockquote></div><br></div></div>