<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
John,<br>
<br>
please stay on the mailing list. This is a public service, if you
want personal support I have to ask for your Oracle customer support
identifier...<br>
<br>
<div class="moz-cite-prefix">On 05.03.2014 20:16, john alexander
sanabria ordonez wrote:<br>
</div>
<blockquote
cite="mid:CAJRMTPeoTk0WeA1u4eRKsQh4babhi3XDwYh4wfx7oyD8J37GBg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>Hi Klaus,<br>
<br>
</div>
I read the documentation but (from my experience) it does
not behave as I was expecting. For instance, I do understand
that the deleteConfig method does not reach the 100 percent
if there is an error but why the library does not throw an
exception informing about it. In addition, why if the
previous method (delete) works with no errors this time
"deleteConfig" will generate any error? <br>
</div>
</div>
</div>
</blockquote>
The asynchronous part of the deletion might fail (and that's exactly
the same as in older versions, just the method name has been
changed), and your code will simply hang as it doesn't properly
check for completion. Failed async operations usually will never
reach 100% - why should they, they failed before.<br>
<br>
These failures will NOT cause exceptions from the progress object
method calls, you have to check for them explicitly. It's been
always like that, and there's lots of sample code out there which
shows how to do this properly.<br>
<blockquote
cite="mid:CAJRMTPeoTk0WeA1u4eRKsQh4babhi3XDwYh4wfx7oyD8J37GBg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>About the wait, this is the actual code<br>
<br>
out << "To delete "<br>
mediums.each {<br>
out << <a
moz-do-not-send="true" href="http://it.name">it.name</a> + "
"<br>
}<br>
def iprogress =
machine.delete(mediums)<br>
out << "\nDeleting "<br>
while (iprogress.percent != 100) {<br>
</div>
</div>
</blockquote>
Do not check for 100%, check if iprogress.getCompletion returns
non-zero (dunno if the true/false stuff makes it all the way to
Groovy).<br>
<blockquote
cite="mid:CAJRMTPeoTk0WeA1u4eRKsQh4babhi3XDwYh4wfx7oyD8J37GBg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
out << "."<br>
out.flush()<br>
Thread.sleep(500)<br>
</div>
</div>
</blockquote>
Again, you're ignoring that you should wait using the method from
the progress object, iprogress.waitForCompletion(500) as this gives
the API middleware the opportunity to run its event queues and so
on.<br>
<br>
PLEASE have a look at the Java sample (TestVBox.java), it contains
many useful code sequences which are verified to be sensible (not
that all of them go into extreme error checking, but at least do the
bare minimum necessary to avoid hangs).<br>
<br>
Klaus<br>
<blockquote
cite="mid:CAJRMTPeoTk0WeA1u4eRKsQh4babhi3XDwYh4wfx7oyD8J37GBg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div> }<br>
</div>
John,<br>
<div>
<div>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On 4 March 2014 13:55, Klaus Espenlaub
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:klaus.espenlaub@oracle.com" target="_blank">klaus.espenlaub@oracle.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<div class=""><br>
On 04.03.2014 14:44, john alexander sanabria ordonez
wrote:<br>
> Hi,<br>
><br>
> I wrote a Groovy script to use the Java binding to
manage virtual<br>
> machines through the VirtualBox web service
interface. My script worked<br>
> well in VirtualBox 4.2.x but when I updated to
version 4.3 I noted that<br>
> my unregistervm procedure does not work. First, the
IMachine.delete<br>
> method was not available and it was changed by
IMachine.deleteConfig<br>
> which basically works similarly to the delete method.
I made the<br>
> corresponding modifications however it does not
delete the mediums<br>
> returned by the IMachine.unregister method.<br>
<br>
</div>
This is documented in the SDK reference, for the API changes
in 4.3.<br>
<div class="">><br>
> My unregistervm methods looks similar to this<br>
><br>
> def mediums =
machine.unregister(CleanupMode.DetachAllReturnHardDisksOnly)<br>
> def iprogress = machine.deleteConfig(mediums)<br>
> while (iprogress.percent < 100) {<br>
> out << "."<br>
> }<br>
><br>
> and it never ends because the iprogress.percent never
reaches 100.<br>
><br>
> What I am doing wrong? Thanks for your help.<br>
<br>
</div>
The percentage will never reach 100 if there is any error.
You should be<br>
adding more flexible progress checking (there should be
enough working<br>
samples out there, including the Java sample code). What you
have is<br>
asking for hangs. Also, you should at least have some wait
for<br>
completion (if you prefer with very low timeout), as
otherwise you're<br>
simply burning CPU cycles.<br>
<br>
Klaus<br>
<br>
><br>
> John,<br>
>
</blockquote>
</div>
</div>
</blockquote>
</body>
</html>