[vCloud Driver] Problem with the attach_disk driver action

Hi!

I’m working on the vCloud driver for OpenNebula and now I’m trying to add the attach_disk capability to the driver. First I want to try to attach volatile disks.

I have some problems with the connection between one core and the attach_disk action file and for that I need to understand which ONE files are executed in the attach_disk call.

I think that ONE core don’t execute var/lib/one/remotes/vmm/vcloud/attach_disk, but I don’t know why.

When I attach disk from sunstone, the VM still in HOTPLUG state and don’t change the state.

I have checked oned.log file and the action was executed succesfully.

Mon Nov 14 15:06:27 2016 [Z0][ReM][D]: Req:3440 UID:0 VirtualMachineAttach invoked , 663, "DISK=[…"
Mon Nov 14 15:06:28 2016 [Z0][ReM][D]: Req:3440 UID:0 VirtualMachineAttach result SUCCESS, 663

The driver’s entry in oned.conf is this:

VM_MAD = [
NAME = “vcloud”,
SUNSTONE_NAME = “VMWare vCloud”,
EXECUTABLE = “one_vmm_sh”,
ARGUMENTS = “-p -t 15 -r 0 vcloud -s sh”,
TYPE = “xml”,
KEEP_SNAPSHOTS = “yes”,
IMPORTED_VMS_ACTIONS = “terminate, terminate-hard, hold, release, suspend,
resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
snap-create, snap-delete”
]

I started to follow the chain of calls:

one_vmm_sh -> one_vmm_exec -> madcommon.sh -> one_vmm_exec.rb --> function attach_disk
-> tm_attach I don’t know what is doing this.
-> var/lib/one/remotes/vmm/vcloud/attach_disk

I don’t know where is the trouble and where the chain of calls is stopped, has someone any idea?

Thanks.

Does VM log shed some light on what it is doing?

It could happen that the action is trying to execute tm_attach, here are the steps done in attach disk:

Do you have ds and tm drivers for vCloud datastores? These are for vcenter:

Hi Javi!

When I attach a disk to the VM in the VM log appears the next information

Tue Nov 15 11:21:53 2016 [Z0][VM][I]: New LCM state is HOTPLUG

And the VM remains in that state.

I’ve created this files:

In tm/vcloud:
delete
mkimage

In datastore/vcloud:
mkfs
stat
monitor
rm

The volatile disk would have to be created in vCloud Infraestucture remotely.

In one_vmm_exec.rb, wich action is tm_attach? wich files are called in tm_attach?
Because in tm directory there is no file called attach or something like that.

Thanks!

tm_attach is just a placeholder. The command comes in the xml message sent to the action. The exact command is in tm_command. I believe it is clone, mkimage or ln depending on what are you attaching.

Yes, I’m trying to attach volatile disks. I think the problem is the tm_command doesn’t come in the xml message. And then it crashes. I comment some lines in one_vmm_exec.rb to avoid to work with tm_command and it works fine, but I would prefer uncommend those lines and work comonly.
For my case, I believe I don’t need to use tm and datastore drivers because my disks are placed outside in vCloud infrastructure.

def attach_disk(id, drv_message)
action = ACTION[:attach_disk]
xml_data = decode(drv_message)

    if (@hypervisor != "vcloud")
        tm_command = ensure_xpath(xml_data, id, action, 'TM_COMMAND') || return
        tm_rollback= xml_data.elements['TM_COMMAND_ROLLBACK'].text.strip
    end

    target_xpath = "VM/TEMPLATE/DISK[ATTACH='YES']/TARGET"
    target     = ensure_xpath(xml_data, id, action, target_xpath) || return

    target_index = target.downcase[-1..-1].unpack('c').first - 97

    action = VmmAction.new(self, id, :attach_disk, drv_message)

    if (@hypervisor == "vcloud")

        steps = [            
                 
        # Run the attach vmm script
        {
            :driver       => :vmm,
            :action       => :attach_disk,
            :parameters   => [
                    :deploy_id,
                    :disk_target_path,
                    target,
                    target_index,
                    drv_message
            ]
        }
        ]             
    else

        steps = [
        
        # Perform a PROLOG on the disk
        {
            :driver     => :tm,
            :action     => :tm_attach,
            :parameters => tm_command.split
        },           
        # Run the attach vmm script
        {
            :driver       => :vmm,
            :action       => :attach_disk,
            :parameters   => [
                    :deploy_id,
                    :disk_target_path,
                    target,
                    target_index,
                    drv_message
            ],
            :fail_actions => [
                {
                    :driver     => :tm,
                    :action     => :tm_detach,
                    :parameters => tm_rollback.split
                }
            ]
        }
        ]
    end        

    action.run(steps)
end