framework icon indicating copy to clipboard operation
framework copied to clipboard

cannot remove a node that has vtemplate

Open yongshengma opened this issue 7 years ago • 3 comments

A node can not be removed if there's vtemplate on it or owned by it let's say. Is there any workaround to remove this node?

Related issue might be #2035 .

yongshengma avatar Sep 30 '18 03:09 yongshengma

Hi @yongshengma vTemplates are read-only volumes. To read from them, they'd have to be running somewhere. The GUI currently doesn't support moving vTemplates across different nodes. The API and the controllers do. (API: /vdisks/GUID/move, data being {'target_storagerouter_guid': GUID}). Controller: VDiskController.move) Here is a small script to move all vtemplates to a different storagerouter

import random
from ovs.dal.lists.vdisklist import VDiskList
from ovs.lib.vdisk import VDiskController

vtemplates = [vd for vd in VDiskList.get_vdisks() if vd.is_vtemplate]
for vtemplate in vtemplates:
    vpool = vtemplate.vpool
    try:
        destination_std = random.choice([storagedriver for storagedriver in vpool.storagedrivers if storagedriver.storagedriver_id != vtemplate.storagedriver_id])
    except IndexError:
        print 'No destinations available'
        continue
    print 'Moving {0} to {1}'.format(vtemplate.name, destination_std.storagerouter.name)
    VDiskController.move(vdisk_guid=vtemplate.guid, target_storagerouter_guid=destination_std.storagerouter.guid, force=False)

JeffreyDevloo avatar Oct 01 '18 12:10 JeffreyDevloo

I'll keep this ticket open: The vtemplate section in the GUI should allow the disk to get moved to a different host.

JeffreyDevloo avatar Oct 01 '18 12:10 JeffreyDevloo

Nice! Thanks!

yongshengma avatar Oct 08 '18 04:10 yongshengma