New vm doesn't resize to the size specified in the template

When create a new vm from template, we specify a larger size for the disk, but when we deploy the vm, it doesn’t seem to resize to the new size value. For example, we have a Ubuntu 17.04 template of 10G, and we specified that we wanted 15G disk. After deploying the vm, we run the command # fdsik -l to check the disk, but we only see 10G, not the rest of the space. Therefore, the OS has not been resized to the new size value during the deployment proccess:

root@vm-3756:~# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf72b05ef

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *      2048   391167   389120  190M 83 Linux
/dev/sda2       391168 20969471 20578304  9.8G 8e Linux LVM


Disk /dev/mapper/vg--ubuntu-root: 9.8 GiB, 10531897344 bytes, 20570112 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

The template of the current vm:

    DISK = [
  CLONE = "YES",
  CLONE_TARGET = "SYSTEM",
  CLUSTER_ID = "100,103,104",
  DATASTORE = "netapp",
  DATASTORE_ID = "100",
  DEV_PREFIX = "hd",
  DISK_ID = "0",
  DISK_SNAPSHOT_TOTAL_SIZE = "0",
  DISK_TYPE = "FILE",
  DRIVER = "qcow2",
  IMAGE = "ubuntu-17.04-img",
  IMAGE_ID = "313",
  IMAGE_STATE = "2",
  IMAGE_UNAME = "cigonzalez",
  LN_TARGET = "NONE",
  ORDER = "1",
  ORIGINAL_SIZE = "10240",
  READONLY = "NO",
  SAVE = "NO",
  SIZE = "15360",
  SOURCE = "/var/lib/one//datastores/100/f8001c51549e0dc234fe5676ac894d3b",
  TARGET = "hda",
  TM_MAD = "shared",
  TYPE = "FILE" ]

If we execute the command qemu-img info disk.0 in the vm’s directory, we get:

[root@node2201-1 3756]# qemu-img info disk.0
image: disk.0
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 3.4G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false

As we can see, the virtual size is 10G, not 15G as we had previously specified.
To resize the virtual machine to its actual size, we have to run qemu-img resize disk.0 +5G, and when we start the virtual machine, is when the virtual machine will notice the extra space, so we’ll be able to extend the logic volume

Components:

  • We have ONE 5.2.0 and we are using the contextualization packages version 5.3.0.

  • About qemu and kvm:

    qemu-kvm-1.5.3-105.el7_2.4.x86_64
    qemu-kvm-common-1.5.3-105.el7_2.4.x86_64
    qemu-img-1.5.3-105.el7_2.4.x86_64

  • The hosts, are running CentOS 7.

We have this problem with any vm non persistent.

Thanks in advance.


Hi, looks like incorrectly defined system ds. Please paste here system ds template