Hello, I have a script for auto-reuild of CentOS 5 DomU''s (on top of CentOS 5 Dom0) and basically what it does is: xm destroy $domain sleep 2 lvremove ...$domain''s LV Sometimes, the domain doesn''t destroy within 2 second and the script fails. I added tests to check that the domain is destroyed before the lvremove but was wondering whether there is a more elegant way to just run a command that will exit when the domain is no longer alive. Is there? Thanks, --Amos _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Jul 17, 2008, at 05:18 , Amos Shapira wrote:> Hello, > > I have a script for auto-reuild of CentOS 5 DomU''s (on top of CentOS 5 > Dom0) and basically what it does is: > > xm destroy $domain > sleep 2 > lvremove ...$domain''s LV > > Sometimes, the domain doesn''t destroy within 2 second and the script > fails. > I added tests to check that the domain is destroyed before the > lvremove but was wondering whether there is a more elegant way to just > run a command that will exit when the domain is no longer alive. > > Is there?Well, you easily make a command out of something like this: while xenstore-exists /local/domain/$DOMID/vm ; do sleep 1; done cheers, robert _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Why don''t you use && ? _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Jul 17, 2008, at 14:24 , Thomas wrote:> Why don''t you use && ?Do you mean this? xm destroy foo && lvremove blah That doesn''t work (for the same reason "sleep 2" didn''t) because "xm destroy" is asynchronous. You need to ensure domain cleanup has actually completed before moving on. robert> > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Thanks for the info. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
2008/7/18 Robert Read <rread@datarithm.com>:> Well, you easily make a command out of something like this: > > while xenstore-exists /local/domain/$DOMID/vm ; do sleep 1; doneAh good! Thanks. That''s the sort of thing I was looking for. Looks like I''ll have to learn about the entire xenstore-* command family. Cheers, --Amos _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Amos Shapira wrote:> 2008/7/18 Robert Read <rread@datarithm.com>: >> Well, you easily make a command out of something like this: >> >> while xenstore-exists /local/domain/$DOMID/vm ; do sleep 1; done > > Ah good! Thanks. That''s the sort of thing I was looking for. > > Looks like I''ll have to learn about the entire xenstore-* command family.What I do, on the commandline anyway is: xm shutdown $DOMU ; xm console $DOMU ; do some stuff the console exits to the dom0 commandline when the domU finishes. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Steve Wray wrote:> Amos Shapira wrote: >> 2008/7/18 Robert Read <rread@datarithm.com>: >>> Well, you easily make a command out of something like this: >>> while xenstore-exists /local/domain/$DOMID/vm ; do sleep 1; done >> Ah good! Thanks. That''s the sort of thing I was looking for. >> Looks like I''ll have to learn about the entire xenstore-* command family. > What I do, on the commandline anyway is: > xm shutdown $DOMU ; xm console $DOMU ; do some stuff > the console exits to the dom0 commandline when the domU finishes.Slightly less clean, I use xm shutdown $DOMU; wait=0; until (( $wait == 1 )); do sleep 10; xm list | egrep "$DOMU" > /dev/null; wait=$? done I think it''s time for me also to go and read about xenstore-* Cheers, Greg. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users