[Libguestfs] [PATCH] v2v: -i libvirt: If <vcpu> is missing, calculate it from CPU topology.

Richard W.M. Jones rjones at redhat.com
Thu Mar 16 21:09:57 UTC 2017


On Thu, Mar 16, 2017 at 08:55:41PM +0000, Richard W.M. Jones wrote:
> On Thu, Mar 16, 2017 at 07:13:12PM +0000, Richard W.M. Jones wrote:
> > +  (* Get the <vcpu> field from the input XML.  If not set then
> > +   * try calculating it from the <cpu> <topology> node.  If that's
> > +   * not set either, then assume 1 vCPU.
> > +   *)
> > +  let vcpu = xpath_int "/domain/vcpu/text()" in
> > +  let vcpu =
> > +    match vcpu, cpu_sockets, cpu_cores, cpu_threads with
> > +    | Some vcpu, _,    _,    _ -> vcpu
> > +    | None,      None, None, None -> 1
> > +    | None,      _,    _,    _ ->
> > +       let sockets = match cpu_sockets with None -> 1 | Some v -> v in
> > +       let cores = match cpu_cores with None -> 1 | Some v -> v in
> > +       let threads = match cpu_threads with None -> 1 | Some v -> v in
> > +       sockets * cores * threads in
> 
> Ooops, this hunk is wrong.  I'll post a v2 once I fix it.

In fact it's the test which was wrong.  Patch v2 posted in a new thread.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list