[vbox-dev] machine.delete() strange behavior Windows 7 (Python)

Thomas Belian thomas.belian at fh-erfurt.de
Tue Aug 27 12:29:50 GMT 2013


>>> On 8/26/2013 at 08:27 PM, in message <521B9E2D.7000905 at oracle.com>,
Klaus
Espenlaub <klaus.espenlaub at oracle.com> wrote: 
> Hi Thomas,
> 

Hello Klaus,

> On 26.08.2013 16:57, Thomas Belian wrote:
> > Hello,
> >
> > I'm trying to build a program which reads an XML file and control
> > VirtualBox in a way VNUML works
> > (http://web.dit.upm.es/vnumlwiki/index.php/Main_Page).
> >
> > My whole program works but I have one problem.
> >
> > For removing my scenario after working with it I use the following
> > line:
> >
> > 
>
machine.delete(machine.unregister(self.constants.CleanupMode_DetachAllReturnH
> ardDisksOnly))
> >
> > which works very well under Scientific Linux 6.4 and Ubuntu 12.04
LTS,
> > but on Windows 7 64 Bit all settings will be deleted, but not the
hard
> > disk, which is a linked clone.
> 
> This is unfortunately (to me) ambiguous. Do you have the 100%
identical 
> (structurally) setup on both Linux and Windows, i.e. that the linked

> clone is there in both cases, set up in the same way?

Yes. the only differences:

on Windows I use:
Python 2.7.5 (64Bit)
PyWin32 218 for Python 2.7 (64Bit)
VirtualBox 4.2.16 from virtualbox.org

on Linux (64Bit) I use:
Python 2.6.6 (Scientific Linux)
Python 2.7.3 (Ubuntu)
VirtualBox 4.2.16 from virtualbox.org

I copy my files from one System to the other and on Linux everything
works fine, on Windows not.

> 
> It's expected behavior that this command does NOT delete all disk
images 
> used by this VM. It will only delete what isn't needed for other VMs,

> i.e. that part of the medium tree which is private to this VM. 
> Everything else will be left over.

In the linked close, this should remove the "different" disk images and
let the original image still "registered". But the problem seems to be,
that every settingsfile will be deleted, except the disk images to the
vm (which ist only the differenting image to the original one)
> 
> Your command is doing the same thing as "VBoxManage unregistervm
vmname 
> --delete", so if you think this is behaving differently on Linux and

> Windows then you need to describe exactly how you create the VM
config 
> (exact order of operations, probably it'd be helpful to provide the
VM 
> config files which you produce). Then we should be able to
reproduce.

Ok, interesting, with vboxmanage removing the vm works, but with my
program not. Are there any problems known with PyWin32 218? Or is there
another way to use the COM system in Windows from Python?

For your information. These are my first python or programming steps.
We use VNUML and want to use a more flexible system on work, which is
easy to use and work on Windows as well, so my decision was to learn
programming and try to get the job done by myself.

If anyone has tips for better code, please let me know, there are many
lines I don't really like, but they work for the moment.

If anyone want to try what I have written:

Just checkout my scripts from svn:

http://svn.ai.fh-erfurt.de/subversion/VNBox

You will get there 4 files. 

The problem is in file VNBox_VM.py in method removevm Line 258.

To get the complete program running you need an xml file and an
template operaring system. Both can be downloaded from
http://svn.ai.fh-erfurt.de/tmp/

To get into the problem just use:
VNBox.py test_scenario.xml create (which will create the machines in
VirtualBox)
and
VNBox.py test_scenario.cml remove (which will remove the scenario and
the failure would come up (only on Windows))
There are other parameters available like start (starting the
scenario), stop (try to shutdown the systems with ACPI) and kill
(poweroff).

There are many things to to, but for the moment I have a behavior like
the old VNUML:

Greetings,
Thomas




--
Thomas Belián 

Fachhochschule Erfurt
Fakultät Gebäudetechnik und Informatik
Fachrichtung Angewandte Informatik
Labor Betriebssysteme/Netze


Postfach 45 01 55, 99051 Erfurt

Telefon: 0361 6700 - 647
Telefax: 0361 6700 - 643
E-Mail: thomas.belian at fh-erfurt.de
Web: http://www.ai.fh-erfurt.de





More information about the vbox-dev mailing list