Mailing List Archive

Constructors and Destructors on classes
Hello,

Does a constructor on class VM just create an instance of the class in
Xen's memory or does it actually provision a new VM and conversely, what
does a destructor do, delete the VM class instance from memory or
destroy a virtual machine?

The class "host" and "host_cpu" also have create and destroy methods on
them and since you can't create and destroy a physical host or a
physical cpu, I am guessing that the answer to my question above for VMs
is that the create and destroy methods just instantiate and destroy a
class instance and do not actually cause the provisioning and
decommissioning of a virtual machine.

Gurus, kindly explain..

Thanks,
Hetal

_______________________________________________
xen-api mailing list
xen-api@lists.xensource.com
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
Re: Constructors and Destructors on classes [ In reply to ]
Hi

> Does a constructor on class VM just create an instance of the class
> in Xen's memory or does it actually provision a new VM and
> conversely, what does a destructor do, delete the VM class instance
> from memory or destroy a virtual machine?

Well 'create' creates the representation in xend, and then when you
call 'start' it starts that domain. That should all be working. I
think, after you have shutdown a domain, the destructor deletes its
representation within xend.

> The class "host" and "host_cpu" also have create and destroy
> methods on them and since you can't create and destroy a physical
> host or a physical cpu, I am guessing that the answer to my
> question above for VMs is that the create and destroy methods just
> instantiate and destroy a class instance and do not actually cause
> the provisioning and decommissioning of a virtual machine.

I don't see host create in the latest api spec, it you look in the
repository. And host_cpu create is not implemented. Not sure it
should be in there...

Cheers

Tom

> Gurus, kindly explain..
>
> Thanks,
> Hetal
>
> _______________________________________________
> xen-api mailing list
> xen-api@lists.xensource.com
> http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api


_______________________________________________
xen-api mailing list
xen-api@lists.xensource.com
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api
Re: Constructors and Destructors on classes [ In reply to ]
On Tue, Mar 06, 2007 at 08:06:58PM +0530, Hetal Badheka wrote:

> Hello,
>
> Does a constructor on class VM just create an instance of the class in
> Xen's memory or does it actually provision a new VM and conversely, what
> does a destructor do, delete the VM class instance from memory or
> destroy a virtual machine?

Think of it like a database record. VM.create creates a record, and
VM.destroy deletes that record again. (Xend doesn't actually use a
DBMS, but that's the mental model you need). A running domain is
created and destroyed using VM.start, VM.clean_shutdown, and so on.
VM.create does not imply that a domain is created to match -- you are
merely creating the record corresponding to a non-running VM.

> The class "host" and "host_cpu" also have create and destroy methods on
> them and since you can't create and destroy a physical host or a
> physical cpu, I am guessing that the answer to my question above for VMs
> is that the create and destroy methods just instantiate and destroy a
> class instance and do not actually cause the provisioning and
> decommissioning of a virtual machine.

These methods should never have been added, and will be removed
immediately if they're still there. A host and some host_cpu records
are created implicitly by Xend at startup.

HTH,

Ewan.

_______________________________________________
xen-api mailing list
xen-api@lists.xensource.com
http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-api