vmware-archive / vcd-cli

Command Line Interface for VMware vCloud Director
https://vmware.github.io/vcd-cli
Other
165 stars 108 forks source link

Configure storage profiles for disks belonging to an existing VM in an existing vApp #502

Open anderspetterssonatcgidotcom opened 5 years ago

anderspetterssonatcgidotcom commented 5 years ago

I am trying to figure out how to configure storage profiles for disks belonging to an existing VM in an existing vApp, for example:

C:\>vcd vm info my-vapp-name my-vm-name
property             value
-------------------  --------------------------------------------------
computer-name        my-vm-name
cores-per-socket     2
cpu                  4
deployed             false
description          Testing-20191008
disk-2000            name: Hard disk 1
                     size-MB: 102400
                     bus: 0
                     unit: 0
disk-2001            name: Hard disk 2
                     size-MB: 1024
                     bus: 0
                     unit: 1
id                   urn:vcloud:vm:6f4d968c-ae89-4b4e-b129-fd56e285b13c
memory-MB            8192
moref                vm-3554
name                 my-vm-name
needs-customization  true
nic-0                name: Network adapter 0
                     network: VdcNet-Customer-YYY
                     mode: POOL
                     connected: true
                     mac: aa:aa:aa:aa:aa:aa
                     ip: yyy.yyy.yyy.yyy
os                   windows9Server64Guest
primary-nic          nic-0
status               Powered off
vapp                 my-vapp-name
vm-tools-version     10277

C:\>
C:\>vcd vapp info my-vapp-name
property                 value
-----------------------  ------------------------------------
deployment_lease         0.0w, 0.0d, 0.0h
id                       20d7a3ac-4dae-408a-91c6-2eafc0ef2272
is_shared_to_everyone    False
name                     my-vapp-name
owner                    system
status                   Powered off
storage_lease            0.0w, 0.0d, 0.0h
vapp-net-1               VdcNet-Customer-YYY
vapp-net-1-mode          bridged
vm-1: 4 virtual CPU(s)   4
vm-1: 8192 MB of memory  8,192
vm-1: CD/DVD Drive 1     CD/DVD Drive
vm-1: Floppy Drive 1     Floppy Drive
vm-1: Hard disk 1        107,374,182,400 byte
vm-1: Hard disk 2        1,073,741,824 byte
vm-1: IDE Controller 1   IDE Controller
vm-1: Network adapter 0  POOL: yyy.yyy.yyy.yyy
vm-1: SCSI Controller 0  SCSI Controller
vm-1: computer-name      my-vm-name
vm-1: name               my-vm-name
vm-1: password           **********
vm-1: storage-profile    gold

C:\>vcd vm list-storage-profile my-vapp-name my-vm-name
name
----------
gold
gold

But I cannot find any way of “addressing” the Hard disk 1 or Hard disk 2 the so I am quite unable to configure the storage profile for these two disks?

C:\>vcd vm detach-disk --idisk-id 'Hard disk 1' my-vapp-name my-vm-name
Usage: vcd vm detach-disk [OPTIONS] <vapp-name> <vm-name>
Try "vcd vm detach-disk -h" for help.

Error: Got unexpected extra arguments (my-vapp-name my-vm-name)

C:\>vcd vm detach-disk --idisk-id 'Hard\ disk\ 1' my-vapp-name my-vm-name
Usage: vcd vm detach-disk [OPTIONS] <vapp-name> <vm-name>
Try "vcd vm detach-disk -h" for help.

Error: Got unexpected extra arguments (my-vapp-name my-vm-name)

C:\>vcd vm detach-disk --idisk-id "Hard\ disk\ 1" my-vapp-name my-vm-name
Usage: vcd vm detach-disk [OPTIONS] <vapp-name> <vm-name>
Try "vcd vm detach-disk -h" for help.

Error: No disk found with the given name/id.

C:\>vcd vapp detach my-vapp-name my-vm-name 'Hard disk 1'
Usage: vcd vapp detach [OPTIONS] <vapp-name> <vm-name> <disk-name>
Try "vcd vapp detach -h" for help.

Error: Got unexpected extra arguments (disk 1')

C:\>vcd vapp detach my-vapp-name my-vm-name 'Hard\ disk\ 1'
Usage: vcd vapp detach [OPTIONS] <vapp-name> <vm-name> <disk-name>
Try "vcd vapp detach -h" for help.

Error: Got unexpected extra arguments (disk\ 1')

C:\>vcd vapp detach my-vapp-name my-vm-name "Hard\ disk\ 1"
Usage: vcd vapp detach [OPTIONS] <vapp-name> <vm-name> <disk-name>
Try "vcd vapp detach -h" for help.

Error: No disk found with the given name/id.

C:\>vcd vapp detach my-vapp-name my-vm-name "Hard disk 1"
Usage: vcd vapp detach [OPTIONS] <vapp-name> <vm-name> <disk-name>
Try "vcd vapp detach -h" for help.

Error: No disk found with the given name/id.

I am clearly missing something fundamental here and I would love to understand how to obtain the disk id? I am using Windows Server 2016 Python 3.7.4 vcd-cli 22.0.0 pyvcloud 21.0.1.dev3