Hi Geoff, We have raised the issue with citrix cloudPlatform and I believe they are working on it and should contribute the fix back to cloudstack.
The problem itself as follows if you have more than one host in the XEN cluster with the local storage and send the prepare_template api call for a new template the secondary storage template NFS directory will be mounted as SR on all hosts in the cluster and you will get the following error in the log GetStorageStats Exception:SR_BACKEND_FAILURE_40The SR scan failed [opterr=['INTERNAL_ERROR', 'Db_exn.Uniqueness_constraint_violation("VDI", "uuid", "9fc07770-b9c0-4db6-a0e0-48a24c901db7")']] The template will be copied to the local storage on only server in the cluster and you will have to repeat the command to copy the template again. The only way to check if the template was copied to the local storage will be to query the cloud.template_spool_ref table. Best regards Yuri ---------------------------------------- > From: geoff.higginbot...@shapeblue.com > To: users@cloudstack.apache.org > Subject: Re: Xen - Deploying servers from a template > Date: Wed, 29 Apr 2015 10:28:29 +0000 > > Hi Yuri, > > Thanks for adding some more detail to the thread. > > You say that the prepare template api does not work for you, I have not had > the same experience so could you share more details and ideally log a jira > ticket etc > > Regards > > Geoff Higginbottom > CTO / Cloud Architect > > D: +44 20 3603 0542<tel:+442036030542> | S: +44 20 3603 > 0540<tel:+442036030540> | M: +447968161581<tel:+447968161581> > > geoff.higginbot...@shapeblue.com<mailto:geoff.higginbot...@shapeblue.com> | > www.shapeblue.com<htp://www.shapeblue.com/> | > Twitter:@cloudstackguru<https://twitter.com/#!/cloudstackguru> > > ShapeBlue Ltd, 53 Chandos Place, Covent Garden, London, WC2N > 4HS<x-apple-data-detectors://5> > > > On 29 Apr 2015, at 14:10, Yuri Kogun > <yko...@outlook.com<mailto:yko...@outlook.com>> wrote: > > Just wanted to add from the personal experience that the process of copying > template is sequential as the secondary storage can be mounted only on one > host in the cluster (due to SR locking issue) . We use local storage in > production and normally prepare the template by starting the vm with is on > every host in the cluster in the quiet time. The prepare_template API call > does not work properly. > The other problem is that the XEN server host is unusable until the template > copy is finished and all other calls to start VM's on the host will have to > wait. > > Best regards > Yuri Kogun > ---------------------------------------- > From: > geoff.higginbot...@shapeblue.com<mailto:geoff.higginbot...@shapeblue.com> > To: users@cloudstack.apache.org<mailto:users@cloudstack.apache.org> > Subject: Re: Xen - Deploying servers from a template > Date: Tue, 28 Apr 2015 11:58:55 +0000 > > The first time a template is used, it is copied from Secondary to Primary, > then the VM is created, and in the case of XenServer is created as a > Œlinked clone¹. This linking of the VM to the Template means that whilst > there are VMs allocated to Primary Storage, the templates that the VMs are > using will always remain on Primary Storage. > > If a 2nd VM is created based on the same template, the template is already > on Primary Storage so is not copied again. > > If all the VMs which were using a Template are deleted or migrated to > alternate storage, the Template is no longer required and will be deleted > from Primary Storage. > > This automatic clean up can be disabled by updating the global setting > storage.template.cleanup.enabled > > Regards > > Geoff Higginbottom > CTO / Cloud Architect > > D: +44 20 3603 0542 <tel:+442036030542> | S: +44 20 3603 0540 > <tel:+442036030540> | M: +447968161581 <tel:+447968161581> > > geoff.higginbot...@shapeblue.com<mailto:geoff.higginbot...@shapeblue.com> | > www.shapeblue.com<http://www.shapeblue.com> > <htp://www.shapeblue.com/> | Twitter:@cloudstackguru > <https://twitter.com/#!/cloudstackguru> > > ShapeBlue Ltd, 53 Chandos Place, Covent Garden, London, WC2N 4HS > <x-apple-data-detectors://5> > > > > > On 28/04/2015 15:13, "cs user" > <acldstk...@gmail.com<mailto:acldstk...@gmail.com>> wrote: > > Hi All, > > Quick question with regards to xenserver and deploying a cloudstack > instance from a template stored within secondary storage. > > In this case it is secondary storage using NFS and deploying to local disk > on the xenserver. (cloudstack 4.3, Xen 6.0.1) > > I believe this script is used to pull down the template: > /opt/cloud/bin/copy_vhd_from_secondarystorage.sh > > I'm seeing a big variation when deploying 3 servers, for example. 2 of the > servers might start very quickly and one may take longer. > > Is there any caching of the template taking place on the xen host its > self? > If a host has previously deployed a template, and is then asked to deploy > a > new instance using the template, will it have to go back to secondary > storage again or can it use a local cache of the vhd file? > > Many thanks in advance for any responses. > > Cheers! > > Find out more about ShapeBlue and our range of CloudStack related services > > IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//> > CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/> > CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/> > CloudStack Software > Engineering<http://shapeblue.com/cloudstack-software-engineering/> > CloudStack Infrastructure > Support<http://shapeblue.com/cloudstack-infrastructure-support/> > CloudStack Bootcamp Training > Courses<http://shapeblue.com/cloudstack-training/> > > This email and any attachments to it may be confidential and are intended > solely for the use of the individual to whom it is addressed. Any views or > opinions expressed are solely those of the author and do not necessarily > represent those of Shape Blue Ltd or related companies. If you are not the > intended recipient of this email, you must neither take any action based upon > its contents, nor copy or show it to anyone. Please contact the sender if you > believe you have received this email in error. Shape Blue Ltd is a company > incorporated in England & Wales. ShapeBlue Services India LLP is a company > incorporated in India and is operated under license from Shape Blue Ltd. > Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is > operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company > registered by The Republic of South Africa and is traded under license from > Shape Blue Ltd. ShapeBlue is a registered trademark. > > Find out more about ShapeBlue and our range of CloudStack related services > > IaaS Cloud Design & Build<http://shapeblue.com/iaas-cloud-design-and-build//> > CSForge – rapid IaaS deployment framework<http://shapeblue.com/csforge/> > CloudStack Consulting<http://shapeblue.com/cloudstack-consultancy/> > CloudStack Software > Engineering<http://shapeblue.com/cloudstack-software-engineering/> > CloudStack Infrastructure > Support<http://shapeblue.com/cloudstack-infrastructure-support/> > CloudStack Bootcamp Training > Courses<http://shapeblue.com/cloudstack-training/> > > This email and any attachments to it may be confidential and are intended > solely for the use of the individual to whom it is addressed. Any views or > opinions expressed are solely those of the author and do not necessarily > represent those of Shape Blue Ltd or related companies. If you are not the > intended recipient of this email, you must neither take any action based upon > its contents, nor copy or show it to anyone. Please contact the sender if you > believe you have received this email in error. Shape Blue Ltd is a company > incorporated in England & Wales. ShapeBlue Services India LLP is a company > incorporated in India and is operated under license from Shape Blue Ltd. > Shape Blue Brasil Consultoria Ltda is a company incorporated in Brasil and is > operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company > registered by The Republic of South Africa and is traded under license from > Shape Blue Ltd. ShapeBlue is a registered trademark.