[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-16 Thread Nir Soffer
On Mon, Jan 13, 2020 at 11:18 AM  wrote:

> Hallo Jan,
>
> maybe I worded my findings not clearly enough, sorry. oVirt is showing
> that the disk I create is 500GiB (like in your test) but inside the CentOS
> VM I have only a 8GiB disk, which I can see with lsblk and fdisk.
>

Can you share the output of this command on the image being uploaded?

qemu-img info /path/to/omage

oVirt SDK lets you create disk of any size when you upload an image. You
must create disk
large enough to be able to upload the image, but oVirt cannot prevent you
from creating a bigger
disk, and it can make sense for some cases.

The virtual size of the disk is called provisioned_size in the SDK. This
must be the same size
as reported by qemu-img info "virtual size". It you specify smaller value
the upload will fail at
the end, when oVirt verify that uploaded image. Specifying more is allowed
(for backward
compatibility) but is not recommended.

When uploading qcow2 images to block storage (e.g iSCSI/FC) you must
specify the initial_size.
You can find this value using:

qemu-img measure -f qcow2 -O qcow2 /path/to/image.qcow2

You must use the value returned as "required size".

The best tool to upload images is upload_disk.py from ovirt sdk examples:
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/upload_disk.py

With oVirt 4.4 you can upload any image format to any disk format, and the
tool detect the image
format and calculate the correct size without errors.

Here are some examples (eliminating the engine details).

Upload raw image to qcow2 disk:

$ python3 upload_disk.py ... --disk-format qcow2 --disk-sparse
fedora-30.raw Checking image... Image format: raw Disk format: cow Disk
content type: data Disk provisioned size: 6442450944 Disk initial size:
1236336640 Disk name: fedora-30.qcow2 Connecting... Creating disk...
Creating transfer session... Uploading image... [ 100.00% ] 6.00 GiB, 4.27
seconds, 1.40 GiB/s Finalizing transfer session... Upload completed
successfully

Upload qcow2 disk to raw disk:

$ python3 upload_disk.py ... --disk-format raw --disk-sparse disk.qcow2
Checking image... Image format: qcow2 Disk format: raw Disk content type:
data Disk provisioned size: 6442450944 Disk initial size: 6442450944 Disk
name: disk.raw Connecting... Creating disk... Creating transfer session...
Uploading image... [ 100.00% ] 6.00 GiB, 4.51 seconds, 1.33 GiB/s
Finalizing transfer session... Upload completed successfully

Run upload_disk.py --help to learn about the available options.

I guess the ansible module should be updated to upload the disk properly
based on the sdk example.

Nir
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/PTVW6I2JTAARPXDZXXH5R6MX7DPH76CM/


[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-16 Thread Jan Zmeskal
Hello m.skrzetuski (unfortunately I don't know your first name),

have you reported the bug? If yes, can you please share it with me? If no,
I'll try to find some time to reproduce and report it.

Jan

On Wed, Jan 15, 2020 at 7:58 AM Lucie Leistnerova 
wrote:

> It looks to me like a bug. It shouldn't resize the uploaded disk (as it
> is in UI) or it should be mentioned in the documentation.
>
> Can you please create a BZ for it with logs and ansible verbose output
> attached.
>
> Thank you!
>
> On 1/13/20 10:16 AM, m.skrzetu...@gmail.com wrote:
> > Hallo Jan,
> >
> > maybe I worded my findings not clearly enough, sorry. oVirt is showing
> that the disk I create is 500GiB (like in your test) but inside the CentOS
> VM I have only a 8GiB disk, which I can see with lsblk and fdisk.
> >
> > Any workarounds for that? Is CentOS doing something wrong here?
> >
> > I am using Ansible 2.9.
> >
> > Kind regards
> > Skrzetuski
> > ___
> > Users mailing list -- users@ovirt.org
> > To unsubscribe send an email to users-le...@ovirt.org
> > Privacy Statement: https://www.ovirt.org/site/privacy-policy/
> > oVirt Code of Conduct:
> https://www.ovirt.org/community/about/community-guidelines/
> > List Archives:
> https://lists.ovirt.org/archives/list/users@ovirt.org/message/RD2CQSITNXWLPSEVEGYQPQQFPPTS3UK4/
>
> --
> Lucie Leistnerova
> Senior Quality Engineer, QE Cloud, RHVM
> Red Hat EMEA
>
> IRC: lleistne @ #rhev-qe
> ___
> Users mailing list -- users@ovirt.org
> To unsubscribe send an email to users-le...@ovirt.org
> Privacy Statement: https://www.ovirt.org/site/privacy-policy/
> oVirt Code of Conduct:
> https://www.ovirt.org/community/about/community-guidelines/
> List Archives:
> https://lists.ovirt.org/archives/list/users@ovirt.org/message/ACHR56D4SIZJ6PLBDND3SD4DELGEFQVA/
>


-- 

Jan Zmeskal

Quality Engineer, RHV Core System

Red Hat 

___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/D22VHH6KBHQ55EOD432NS7UBJNSF6HLY/


[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-14 Thread Lucie Leistnerova
It looks to me like a bug. It shouldn't resize the uploaded disk (as it 
is in UI) or it should be mentioned in the documentation.


Can you please create a BZ for it with logs and ansible verbose output 
attached.


Thank you!

On 1/13/20 10:16 AM, m.skrzetu...@gmail.com wrote:

Hallo Jan,

maybe I worded my findings not clearly enough, sorry. oVirt is showing that the 
disk I create is 500GiB (like in your test) but inside the CentOS VM I have 
only a 8GiB disk, which I can see with lsblk and fdisk.

Any workarounds for that? Is CentOS doing something wrong here?

I am using Ansible 2.9.

Kind regards
Skrzetuski
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/RD2CQSITNXWLPSEVEGYQPQQFPPTS3UK4/


--
Lucie Leistnerova
Senior Quality Engineer, QE Cloud, RHVM
Red Hat EMEA

IRC: lleistne @ #rhev-qe
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/ACHR56D4SIZJ6PLBDND3SD4DELGEFQVA/


[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-13 Thread Jan Zmeskal
Maybe it's just what Lucie mentioned - that we cannot really resize the
original disk size of CentOS image. I think workaround for that would be
using the original QCOW image as boot disk for OS and then creating a new
disk for data of whatever size you want it to be.

On Mon, Jan 13, 2020 at 10:18 AM  wrote:

> Hallo Jan,
>
> maybe I worded my findings not clearly enough, sorry. oVirt is showing
> that the disk I create is 500GiB (like in your test) but inside the CentOS
> VM I have only a 8GiB disk, which I can see with lsblk and fdisk.
>
> Any workarounds for that? Is CentOS doing something wrong here?
>
> I am using Ansible 2.9.
>
> Kind regards
> Skrzetuski
> ___
> Users mailing list -- users@ovirt.org
> To unsubscribe send an email to users-le...@ovirt.org
> Privacy Statement: https://www.ovirt.org/site/privacy-policy/
> oVirt Code of Conduct:
> https://www.ovirt.org/community/about/community-guidelines/
> List Archives:
> https://lists.ovirt.org/archives/list/users@ovirt.org/message/RD2CQSITNXWLPSEVEGYQPQQFPPTS3UK4/
>


-- 

Jan Zmeskal

Quality Engineer, RHV Core System

Red Hat 

___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/6LQOTZ2CY5EDDQZJAJDASAJWPHSWJFXE/


[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-13 Thread m . skrzetuski
Hallo Jan,

maybe I worded my findings not clearly enough, sorry. oVirt is showing that the 
disk I create is 500GiB (like in your test) but inside the CentOS VM I have 
only a 8GiB disk, which I can see with lsblk and fdisk.

Any workarounds for that? Is CentOS doing something wrong here?

I am using Ansible 2.9.

Kind regards
Skrzetuski
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/RD2CQSITNXWLPSEVEGYQPQQFPPTS3UK4/


[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-13 Thread Jan Zmeskal
Hi, I can confirm that what Lucie writes is true for the UI. However, I was
able to upload 30 GB disk (virtual size) using ansible. I mean at least
oVirt sees it as 30GiB, see here:

[image: image.png]

I used the following playbook:

---
- hosts: localhost
  gather_facts: false
  vars:
disk_name: centos7
  tasks:

- name: Obtain SSO token
  ovirt_auth:
url: https:///ovirt-engine/api
username: admin@internal
password: 

- name: Create a bootable disk for vm
  ovirt_disk:
auth: "{{ ovirt_auth }}"
name: "{{ disk_name }}"
upload_image_path: /tmp/CentOS-7-x86_64-GenericCloud.qcow2
storage_domain: hosted_storage
size: 30GiB
wait: true
bootable: true
format: cow

- name: Create a VM with QCOW2 disk
  ovirt_vm:
auth: "{{ ovirt_auth }}"
state: present
cluster: Default
name: jzmeskal_centos7
disks:
  - name: "{{ disk_name }}"
bootable: True

It needs to be mentioned that I used Ansible 2.9.1 to achieve it. I don't
know what version you're using, but it might be old. At least the GH link
with oVirt Ansible modules you shared is somewhat dated. I'm not an oVirt
dev, but it's definitely not the case that the modules haven't been updated
for the past two years. You've just checked out some older commit. See for
example here: stable-2.9 branch
.
As of writing this email, the most recent change there is 2 days old.

Hope this helps!
Jan

On Mon, Jan 13, 2020 at 8:56 AM Lucie Leistnerova 
wrote:

> Hi,
>
> On 1/13/20 12:14 AM, m.skrzetu...@gmail.com wrote:
> > Hello everyone,
> >
> > I just saw the list of modules at
> https://github.com/ansible/ansible/tree/663f8464ee7ab2cb086857f04393e643407fba0f/lib/ansible/modules/cloud/ovirt.
> Does this mean you (oVirt devs) did not update ovirt Ansible modules since
> 2 years?
> >
> > Anyhow, the following tasks create a VM with a 8GB instead of 500GB disk
> (confirmed with lsblk and fdisk). Why is that and how do I get around it?
>
> The original image is 8G so I think creating disk with uploaded image
> can't resize it in one step.
> When I try to upload it in UI it doesn't allow me to change the size, it
> just loads the original size of the image.
>
> It could be mentioned in the documentation how it works with size and
> upload_image_path together.
>
> >
> >- name: download centos image
> >  get_url:
> >url:
> https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
> >dest: /data/isos/CentOS-7-x86_64-GenericCloud.qcow2
> >
> >- name: create disk for vm
> >  ovirt_disk:
> >name: centos
> >upload_image_path:
> /data/isos/CentOS-7-x86_64-GenericCloud.qcow2
> >storage_domain: vmdata2
> >size: 500GiB
> >wait: true
> >bootable: true
> >format: cow
> >  when: register_centos_disks.ovirt_disks|length == 0
> >
> >- name: create vm
> >  ovirt_vm:
> >name: dumbo
> >type: server
> >state: "running"
> >cluster: dumbo
> >high_availability: yes
> >disks:
> >  - name: centos
> >graphical_console:
> >  protocol: vnc
> >operating_system: Linux
> >nics:
> >  - name: nic1
> >profile_name: ovirtmgmt
> >memory: 8GiB
> >cpu_sockets: 1
> >cpu_cores: 1
> >cpu_threads: 2
> >
> > If I use sparse: false with the ovirt_disk module I am getting following
> errors.
> >
> > An exception occurred during task execution. To see the full traceback,
> use -vvv. The error was: Error: Fault reason is "Operation Failed". Fault
> detail is "[Cannot add Virtual Disk. Disk configuration (COW Preallocated)
> is incompatible with the storage domain type.]". HTTP response code is 409.
> > fatal: [dumbo]: FAILED! => changed=false
> >msg: Fault reason is "Operation Failed". Fault detail is "[Cannot add
> Virtual Disk. Disk configuration (COW Preallocated) is incompatible with
> the storage domain type.]". HTTP response code is 409.
> >
> > The storage domain type is data. So what is wrong with that?
> >
> > Frustrated regards
> > Skrzetuski
> > ___
> > Users mailing list -- users@ovirt.org
> > To unsubscribe send an email to users-le...@ovirt.org
> > Privacy Statement: https://www.ovirt.org/site/privacy-policy/
> > oVirt Code of Conduct:
> https://www.ovirt.org/community/about/community-guidelines/
> > List Archives:
> https://lists.ovirt.org/archives/list/users@ovirt.org/message/QSFF7CEVQAVCHDCDRZ6NUYUGLVMVWL7A/
> Best regards,
>
> --
> Lucie Leistnerova
> Senior Quality Engineer, QE Cloud, RHVM
> Red Hat EMEA
>
> IRC: lleistne @ #rhev-

[ovirt-users] Re: ovirt_disk Ansible module creating disks of wrong size but why?

2020-01-12 Thread Lucie Leistnerova

Hi,

On 1/13/20 12:14 AM, m.skrzetu...@gmail.com wrote:

Hello everyone,

I just saw the list of modules at 
https://github.com/ansible/ansible/tree/663f8464ee7ab2cb086857f04393e643407fba0f/lib/ansible/modules/cloud/ovirt.
 Does this mean you (oVirt devs) did not update ovirt Ansible modules since 2 
years?

Anyhow, the following tasks create a VM with a 8GB instead of 500GB disk 
(confirmed with lsblk and fdisk). Why is that and how do I get around it?


The original image is 8G so I think creating disk with uploaded image 
can't resize it in one step.
When I try to upload it in UI it doesn't allow me to change the size, it 
just loads the original size of the image.


It could be mentioned in the documentation how it works with size and 
upload_image_path together.




   - name: download centos image
 get_url:
   url: 
https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
   dest: /data/isos/CentOS-7-x86_64-GenericCloud.qcow2

   - name: create disk for vm
 ovirt_disk:
   name: centos
   upload_image_path: /data/isos/CentOS-7-x86_64-GenericCloud.qcow2
   storage_domain: vmdata2
   size: 500GiB
   wait: true
   bootable: true
   format: cow
 when: register_centos_disks.ovirt_disks|length == 0

   - name: create vm
 ovirt_vm:
   name: dumbo
   type: server
   state: "running"
   cluster: dumbo
   high_availability: yes
   disks:
 - name: centos
   graphical_console:
 protocol: vnc
   operating_system: Linux
   nics:
 - name: nic1
   profile_name: ovirtmgmt
   memory: 8GiB
   cpu_sockets: 1
   cpu_cores: 1
   cpu_threads: 2

If I use sparse: false with the ovirt_disk module I am getting following errors.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: 
Error: Fault reason is "Operation Failed". Fault detail is "[Cannot add Virtual 
Disk. Disk configuration (COW Preallocated) is incompatible with the storage domain type.]". 
HTTP response code is 409.
fatal: [dumbo]: FAILED! => changed=false
   msg: Fault reason is "Operation Failed". Fault detail is "[Cannot add Virtual 
Disk. Disk configuration (COW Preallocated) is incompatible with the storage domain type.]". 
HTTP response code is 409.

The storage domain type is data. So what is wrong with that?

Frustrated regards
Skrzetuski
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/QSFF7CEVQAVCHDCDRZ6NUYUGLVMVWL7A/

Best regards,

--
Lucie Leistnerova
Senior Quality Engineer, QE Cloud, RHVM
Red Hat EMEA

IRC: lleistne @ #rhev-qe
___
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/users@ovirt.org/message/SOKGFIMYLY2CCB3V3Q74XZGEZBRWMTKW/