OS-7352: VM.update should allow disk resize with update_disks

Details

Issue Type:Improvement
Priority:4 - Normal
Status:Resolved
Created at:2018-11-05T20:38:25.760Z
Updated at:2018-12-04T12:59:11.423Z

People

Created by:Former user
Reported by:Former user
Assigned to:Former user

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2018-12-04T12:59:11.406Z)

Fix Versions

2018-12-06 Grizz (Release Date: 2018-12-06)

Description

As described in RFD 154:

A disk will be growable with update_disks in the payload passed to vmadm update <uuid>. The following grows a disk to 100 GiB.

# vmadm update 926b8205-4b16-6ec4-f9ad-9883a8c84ce1 <<EOF
{
  "update_disks": [
    {
      "path": "/dev/zvol/rdsk/zones/926b8205-4b16-6ec4-f9ad-9883a8c84ce1/disk0",
      "size": 102400
    }
  ]
}
EOF
Successfuly updated 926b8205-4b16-6ec4-f9ad-9883a8c84ce1

To prevent a typo from destroying data, disks may only get smaller if dangerous_allow_shrink is set to true. Suppose there is a desire to further grow the disk to 200 GiB, but there was an input error.

# vmadm update 926b8205-4b16-6ec4-f9ad-9883a8c84ce1 <<EOF
{
  "update_disks": [
    {
      "path": "/dev/zvol/rdsk/zones/926b8205-4b16-6ec4-f9ad-9883a8c84ce1/disk0",
      "size": 20480
    }
  ]
}
EOF
vmadm: ERROR: Can not shrink disk from 102400 MiB to 20480 MiB

With dangerous_allow_shrink set to true this would be allowed. dangerous_allow_shrink is not added to VM's configuration.

# vmadm update 926b8205-4b16-6ec4-f9ad-9883a8c84ce1 <<EOF
{
  "update_disks": [
    {
      "path": "/dev/zvol/rdsk/zones/926b8205-4b16-6ec4-f9ad-9883a8c84ce1/disk0",
      "size": 20480,
      "dangerous_allow_shrink": true
    }
  ]
}
EOF
Successfuly updated 926b8205-4b16-6ec4-f9ad-9883a8c84ce1

Comments

Comment by Jira Bot
Created at 2018-12-04T12:45:40.495Z

smartos-live commit 5bbd31725fc1d57535b0b605a3ca657bde1333e1 (branch master, by Mike Gerdts)

OS-7352 VM.update should allow disk resize with update_disks
Reviewed by: Pedro Palazón Candel <pedro@joyent.com>
Reviewed by: Orlando Vazquez <orlando@joyent.com>
Reviewed by: Dylan Yep <dylan.yep@joyent.com>
Approved by: Pedro Palazón Candel <pedro@joyent.com>