Options

Create vCenter scheduled migration task using PowerCLI

jibbajabbajibbajabba Member Posts: 4,317 ■■■■■■■■□□
I need to migrate some clones to our DR site on regular intervalls. I have scripts which basically create certain clones / delete clones etc. but those clones need to be migrated from the SAN in site A to a cluster and NFS store in site B.

Whilst you can do a cold migration (for both host and storage) cross virtual datacenter and it works, it does not work scripted.
I created a nice script which does that - but the vCenter crashes and after long tickets with VMWare (and thinking I messed up) I got the first reply that migrating of both host and storage is not supported (in vSphere 4) when doing so across sites / datacenter and after showing them their documentation saying the exact oposite, they took the easy way out saying that scripts aren't supported.

Script works locally so there isn't anything wrong with it - it just doesn't like moving host and storage at the same time.

Anyway - long story short - as scheduled tasks / manual migration work, I thought I found the solution - but unfortunately the task will be deleted once the VM is being deleted .. (which needs to be done otherwise the clone task will fail as the VM exists).

To make a long story short - I need to find a way to use PowerCLI to create a scheduled task (basically running after the clone has been created and before it is being deleted).

I found quite a few examples on vmware.com and the internet, but neither example talks about migration .. I have tried to use the posted ones and use my migration script to accomblish that to no avail.

Has anyone have more experience in PowerCLI and that and can help me out ?

There are scripts on vmware.com in how to create scheduled tasks to powercycle / power on / power off / clone / delete / snapshot etc but I can''t seem to change them to fit the bill ....

Pwease :p
My own knowledge base made public: http://open902.com :p

Comments

  • Options
    meadITmeadIT Member Posts: 581 ■■■■□□□□□□
    Does it have to be via PowerCLI? What about the scheduled task wizard in the GUI? Or maybe Orchestrator?
    CERTS: VCDX #110 / VCAP-DCA #500 (v5 & 4) / VCAP-DCD #10(v5 & 4) / VCP 5 & 4 / EMCISA / MCSE 2003 / MCTS: Vista / CCNA / CCENT / Security+ / Network+ / Project+ / CIW Database Design Specialist, Professional, Associate
  • Options
    jibbajabbajibbajabba Member Posts: 4,317 ■■■■■■■■□□
    Like I say - the scheduled task can be created in the GUI but gets automatically deleted when the VM in question is being deleted and we need to do this several times / week for several VMs and it isn't an option for someone to login to the vcenter right on time when the clone has been created and just before it gets deleted to do this - you may as well migrate manually and skip the task altogether ...

    As for Orchestrator - didn't think of it but I believe it isn't used in our organization ...
    My own knowledge base made public: http://open902.com :p
  • Options
    meadITmeadIT Member Posts: 581 ■■■■□□□□□□
    If you can't migrate both host and datastore at the same time, can you try to mimic the migration step by step in your script?

    Example:
    Unregister cloned VM from host: VMware Communities: Unregister and register a list of...
    Copy VM files from one datastore to another: Copy-DatastoreItem vmstore:\Datacenter\Storage1\MyVM\* vmstore:\Datacenter\NFSStorage\MyVM\
    Register cloned VM on new host
    CERTS: VCDX #110 / VCAP-DCA #500 (v5 & 4) / VCAP-DCD #10(v5 & 4) / VCP 5 & 4 / EMCISA / MCSE 2003 / MCTS: Vista / CCNA / CCENT / Security+ / Network+ / Project+ / CIW Database Design Specialist, Professional, Associate
Sign In or Register to comment.