[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13528608#comment-13528608
 ] 

Qian Shaohua commented on CLOUDSTACK-258:
-----------------------------------------

I meet the same problem with CloudStack 3.0.5. And I tried to get it work.
I changed the source StorageManagerImpl.migrateVolumes(List<Volume> volumes, 
StoragePool destPool), set the vmName of DestroyCommand.
Origin:
                destroyCmds.add(new Pair<StoragePoolVO, 
DestroyCommand>(srcPool, new DestroyCommand(srcPool, volume, null)));  

Now:
                  //if the vm is migrated to different cluster in a datacenter 
of vSphere, need to remove the orgin vm in vSphere. 
                //set vmName of the DestroyCommand. [qsh, 20121130]
                String vmName = null;
                if (volume.getVolumeType() == Type.ROOT && 
volume.getInstanceId() != null) {
                    VirtualMachine vm = 
_vmInstanceDao.findByIdIncludingRemoved(volume.getInstanceId());
                    if (vm != null) {
                        vmName = vm.getInstanceName();
                    }
                }
                destroyCmds.add(new Pair<StoragePoolVO, 
DestroyCommand>(srcPool, new DestroyCommand(srcPool, volume, vmName)));

It seemed to work.
Anyone to review it?
                
> Storage migration across cluster failing in VMWare due to 
> com.vmware.vim25.DuplicateName while starting the VM
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-258
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-258
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: VMware
>    Affects Versions: pre-4.0.0
>         Environment: Hypervisor: VMWare 5.0
> MS: RHEL6.3
> Git Revision: 14486767e3c0d28f4a0f9a2ae36cfb3d1e0581a8
> CloudStack-non-OSS-58
>            Reporter: Sowmya Krishnan
>             Fix For: pre-4.0.0
>
>         Attachments: mslog.gz
>
>
> Storage migration across cluster is failing while starting the VM again after 
> migration.
> Steps:
> 1. Stop VM
> 2. Detach data disk if any
> 3. Migrate VM to another Primary storage in another cluster
> 4. Once migration is complete, start VM
> (I've enabled vmotion)
> After migration, the root disk is migrated properly to the new primary 
> storage. But when VM is started, it gives the following exception and moves 
> back again to the original cluster. 
> Exception:
> 2012-10-04 21:26:32,608 DEBUG [agent.transport.Request] 
> (StatsCollector-2:null) Seq 5-1014761311: Received:  { Ans: , MgmtId: 
> 55487956346259, via: 5, Ver: v1, Flags: 10, { GetVmStatsAnswer } }
> 2012-10-04 21:26:36,349 ERROR [vmware.mo.HostMO] 
> (DirectAgent-147:10.102.125.18) VMware createVM_Task failed due to The name 
> 'i-2-18-VM' already exists. com.vmware.vim25.DuplicateName
> 2012-10-04 21:26:36,350 WARN  [vmware.resource.VmwareResource] 
> (DirectAgent-147:10.102.125.18) StartCommand failed due to Exception: 
> java.lang.Exception
> Message: Failed to create VM. vmName: i-2-18-VM
> java.lang.Exception: Failed to create VM. vmName: i-2-18-VM
>         at 
> com.cloud.hypervisor.vmware.resource.VmwareResource.execute(VmwareResource.java:2006)
>         at 
> com.cloud.hypervisor.vmware.resource.VmwareResource.executeRequest(VmwareResource.java:419)
>         at 
> com.cloud.agent.manager.DirectAgentAttache$Task.run(DirectAgentAttache.java:191)
>         at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)
>         at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>         at java.lang.Thread.run(Thread.java:679)
> 2012-10-04 21:26:36,352 DEBUG [agent.manager.DirectAgentAttache] 
> (DirectAgent-147:null) Seq 6-1190068747: Response Received:
> Following are the DB details:
> (Trying to migrate ROOT-18 from PS2 in cluster-1 to PS3 in cluster-2)
> BEFORE MIGRATION
> =================
> mysql> select id, name, cluster_id, pool_type, status from storage_pool;
> +-----+--------------------------------------+------------+-------------------+--------+
> | id  | name                                 | cluster_id | pool_type         
> | status |
> +-----+--------------------------------------+------------+-------------------+--------+
> | 200 | PS1                                  |          1 | NetworkFilesystem 
> | Up     |
> | 201 | PS2                                  |          1 | NetworkFilesystem 
> | Up     |
> | 202 | PS3                                  |          2 | NetworkFilesystem 
> | Up     |
> | 203 | 7515e732-aa3e-4f07-bf20-35cfeb4b8963 |          3 | LVM               
> | Up     |
> | 204 | PS4                                  |          3 | NetworkFilesystem 
> | Up     |
> +-----+--------------------------------------+------------+-------------------+--------+
> 5 rows in set (0.00 sec)
> mysql> select id, pool_id, last_pool_id, instance_id, name, path, state from 
> volumes where name='ROOT-18';
> +----+---------+--------------+-------------+---------+---------+-------+
> | id | pool_id | last_pool_id | instance_id | name    | path    | state |
> +----+---------+--------------+-------------+---------+---------+-------+
> | 22 |     201 |         NULL |          18 | ROOT-18 | ROOT-18 | Ready |
> +----+---------+--------------+-------------+---------+---------+-------+
> 1 row in set (0.00 sec)
> AFTER MIGRATION
> ================
> mysql> select id, pool_id, last_pool_id, instance_id, name, path, state from 
> volumes where name='ROOT-18';
> +----+---------+--------------+-------------+---------+----------------------------------+-------+
> | id | pool_id | last_pool_id | instance_id | name    | path                  
>            | state |
> +----+---------+--------------+-------------+---------+----------------------------------+-------+
> | 22 |     202 |          201 |          18 | ROOT-18 | 
> 397d675e160241798138a053d9cd45cc | Ready |
> +----+---------+--------------+-------------+---------+----------------------------------+-------+
> 1 row in set (0.00 sec)
> WHILE STARTING VM IS IN PROGRESS
> ================================
> mysql> select id, pool_id, last_pool_id, instance_id, name, path, state from 
> volumes where name='ROOT-18';
> +----+---------+--------------+-------------+---------+----------------------------------+-----------+
> | id | pool_id | last_pool_id | instance_id | name    | path                  
>            | state     |
> +----+---------+--------------+-------------+---------+----------------------------------+-----------+
> | 22 |     204 |          202 |          18 | ROOT-18 | 
> 2bd9b9ec875a4447be282199f5a4916a | Migrating |
> +----+---------+--------------+-------------+---------+----------------------------------+-----------+
> 1 row in set (0.00 sec)
> AFTER VM IS STARTED
> ==================
> mysql> select id, pool_id, last_pool_id, instance_id, name, path, state from 
> volumes where name='ROOT-18';
> +----+---------+--------------+-------------+---------+----------------------------------+-------+
> | id | pool_id | last_pool_id | instance_id | name    | path                  
>            | state |
> +----+---------+--------------+-------------+---------+----------------------------------+-------+
> | 22 |     200 |          204 |          18 | ROOT-18 | 
> 559289ecb8754593b9525190548a0f55 | Ready |
> +----+---------+--------------+-------------+---------+----------------------------------+-------+
> 1 row in set (0.00 sec)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to