On Wed, Aug 4, 2021 at 1:38 AM Nir Soffer <nsoffer@redhat.com> wrote:
On Tue, Aug 3, 2021 at 7:29 PM KK CHN <kkchn.in@gmail.com> wrote:
>
> I have asked our VM maintainer to run the  command
>
> # virsh -r dumpxml vm-name_blah    //as Super user
>
> But no output :   No matching domains found that was the TTY  output on  that rhevm node when I executed the command.
>
> Then I tried to execute #  virsh list     //  it doesn't list any VMs  !!!   ( How come this ? Does the Rhevm node need to enable any CLI  with License key or something to list Vms or  to dumpxml   with   virsh ? or its CLI commands ?

RHV undefine the vms when they are not running.

> Any way I want to know what I have to ask the   maintainer    to provide a working a working  CLI   or ? which do the tasks expected to do with command line utilities in rhevm.
>
If the vm is not running you can get the vm configuration from ovirt
using the API:

    GET /api/vms/{vm-id}

You may need more API calls to get info about the disks, follow the <links>
in the returned xml.

> I have one more question :    Which command can I execute on an rhevm node  to manually export ( not through GUI portal) a   VMs to   required format  ?
>
> For example;   1.  I need to get  one  VM and disks attached to it  as raw images.  Is this possible how?
>
> and another    2. VM and disk attached to it as  Ova or( what other good format) which suitable to upload to glance ?

Arik can add more info on exporting.

>   Each VMs are around 200 to 300 GB with disk volumes ( so where should be the images exported to which path to specify ? to the host node(if the host doesn't have space  or NFS mount ? how to specify the target location where the VM image get stored in case of NFS mount ( available ?)

You have 2 options:
- Download the disks using the SDK
- Export the VM to OVA

When exporting to OVA, you will always get qcow2 images, which you can later
convert to raw using "qemu-img convert"

When downloading the disks, you control the image format, for example
this will download
the disk in any format, collapsing all snapshots to the raw format:

 $ python3 /usr/share/doc/python3-ovirt-engine-sdk4/examples/download_disk.py
-c engine-dev 3649d84b-6f35-4314-900a-5e8024e3905c /var/tmp/disk1.raw

To perform this which modules/packages need to be installed in the rhevm host node ?  Does the rhevm hosts come with python3 installed by default ? or I need to install  python3 on rhevm node ? Then  using pip3 to install the  download_disk.py / what the module name to install this sdk ?  any dependency before installing this sdk ? like java need to be installed on the rhevm node ? 

One doubt:  came across  virt v2v while google search,  can virtv2v  be used in rhevm node to export VMs to images ?  or only from other hypervisors   to rhevm only virt v2v supports ?

This requires ovirt.conf file:       // ovirt.conf file need to be created ? or already there  in any rhevm node?

$ cat ~/.config/ovirt.conf
[engine-dev]
engine_url = https://engine-dev
username = admin@internal
password = mypassword
cafile = /etc/pki/vdsm/certs/cacert.pem

Nir

> Thanks in advance
>
>
> On Mon, Aug 2, 2021 at 8:22 PM Nir Soffer <nsoffer@redhat.com> wrote:
>>
>> On Mon, Aug 2, 2021 at 12:22 PM <kkchn.in@gmail.com> wrote:
>> >
>> > I have  few VMs in   Redhat Virtualisation environment  RHeV ( using Rhevm4.1 ) managed by a third party
>> >
>> > Now I am in the process of migrating  those VMs to  my cloud setup with  OpenStack ussuri  version  with KVM hypervisor and Glance storage.
>> >
>> > The third party is making down each VM and giving the each VM image  with their attached volume disks along with it.
>> >
>> > There are three folders  which contain images for each VM .
>> > These folders contain the base OS image, and attached LVM disk images ( from time to time they added hard disks  and used LVM for storing data ) where data is stored.
>> >
>> > Is there a way to  get all these images to be exported as  Single image file Instead of  multiple image files from Rhevm it self.  Is this possible ?
>> >
>> > If possible how to combine e all these disk images to a single image and that image  can upload to our  cloud  glance storage as a single image ?
>>
>> It is not clear what is the vm you are trying to export. If you share
>> the libvirt xml
>> of this vm it will be more clear. You can use "sudo virsh -r dumpxml vm-name".
>>
>> RHV supports download of disks to one image per disk, which you can move
>> to another system.
>>
>> We also have export to ova, which creates one tar file with all exported disks,
>> if this helps.
>>
>> Nir
>>