Skip to contentSkip to conversation

An Introduction to the Xen-API Work

DISCUSSION Ewan Mellor 4 participants 11 messages Nov 4, 2006 – Nov 8, 2006

lore
Share & tools
lore
#0 lore raw

All,

As you may have noticed, the Xen-API development tree has been merged into xen-unstable. The work in this tree has been ongoing since June, and is now ready for wider distribution. I'd like to take a few minutes to describe these changes, and then I'll follow up this email with a more detailed design document.

The Xen-API tree has been released to xen-unstable now, so that it can be stabilised for release as part of Xen 3.0.4. The interfaces discussed below are still open to change, and will only be frozen when Xen 3.0.4 is released.

The Xen-API work had a number of goals:

1. Support the Xen-CIM project in its development of CIM providers for managing Xen-based hosts. DMTF's CIM is the accepted standard for the monitoring and management of hetrogenous clusters, and the Xen-CIM team are working to integrate Xen-based hosts into these environments through the development of a CIM -> Xen bridge.

2. Encourage the development of third-party clients for managing Xen directly. For enterprise-level hetrogeneous environments, the best management interface to use is CIM, but for small, simple deployments, direct lightweight management may be preferred. To this end, we wish to support third parties in the production of clients, by providing an interface that they can use.

3. Integrate the remote management of Xen systems, and make remote management both easy to use and secure.

To this end, the major effort for the Xen-API project has been to provide a interface into Xend that is stable and can be supported in the long term. This will give a solid foundation for the CIM providers, and a guaranteed interface for direct management tools.

This interface is XML-RPC based, with a data-model and message semantics layered on top. The wire-protocol will be guaranteed for the long term, ensuring that clients using it will be binary-compatible with all Xen releases after Xen 3.0.4.

As well as fixing the wire protocol, we will be providing bindings written in a number of languages, and making these available in-tree. tools/libxen contains the new C bindings to this API, and the Python clients can get up-and-running immediately with reflective bindings using xmlrpclib2.

The intention for the bindings is that they will be a thin layer on top of the wire protocol and data model, with little in the way of moving parts. On top of this, we expect libraries such as RedHat's libvirt to add the richer functionality. This split allows the libraries in the Xen tree to be stable and widely used, and allows third parties to innovate on top of that platform.

Lifecycle Changes
-----------------

To manage a VM properly over its whole lifetime, Xend needs to understand more about VMs than it has traditionally done. Xend used to understand VMs only when they were running, receiving configuration parameters for those VMs from the outside, and removing the configuration details again as soon as the VM shut down. This meant that external systems were needed in order to record VM details over the long term, such as the xendomains script. In order to properly manage VMs remotely, this has to be improved, with Xend becoming responsible for tracking VM configuration even once the VM has been shut down.

To this end, there are some new xm commands:

  o  xm new     - Introduces a new VM to Xend
  o  xm delete  - Removes a specified VM
  o  xm start   - Boot a named VM
  o  xm create  - Does what it always did, which now makes it equivalent to

"xm new ; xm start"
o xm suspend - Save a VM to a location under Xend's management
o xm resume - Resume a VM from that same location

xm list will report non-running VMs, if you ask it to, as well as running ones.

Authentication
--------------

Remote management needs proper authentication. At the moment, you must run xm as root if you want to make any changes to the system, and that's the only authentication we have. For Xen 3.0.4, Xend will be enhanced so that it is able to authenticate users through PAM, giving administrators the power to allow Xend operations to be performed, without giving away the root password.

What We've Got
--------------

  o  Many changes to Xend (xen-unstable.hg/tools/python/xen)
  o  New C bindings to the Xen-API (xen-unstable.hg/tools/libxen)
  o  Scripts for experimenting with the Xen-API, much of which will be rolled

into xm in time (xen-unstable.hg/tools/python/scripts)
o A document describing the Xen-API (xen-unstable.hg/docs/xen-api)

What We Need
------------

o Tests for the new xm commands, through xm-test.
o Lots of people trying the new API and the new C bindings, to see whether they meet your needs.
o Implementation of the remaining API functions, in particular the network-related ones, and those on the to-do list in the documentation.

  o  Documentation improvements.
  o  A Xend bug-squash.
  o  Lots of feedback!

Thanks, and have fun,

Ewan.

#1 lore raw

Hello Ewan,

something must have broken while moving the API code into the
xen-unstable repository. I can create multiple Gentoo domains using xapi.py and xapi.domcfg.py, but cannot delete any of them.

Stefan

[email protected] wrote on 11/04/2006 10:29:07 AM:

Quoted 3 lines

All,

As you may have noticed, the Xen-API development tree has been merged

into

Quoted 1 line

xen-unstable. The work in this tree has been ongoing since June, and is

now

Quoted 1 line

ready for wider distribution. I'd like to take a few minutes to

describe

Quoted 1 line

these changes, and then I'll follow up this email with a more detailed

design

Quoted 3 lines

document.

The Xen-API tree has been released to xen-unstable now, so that it can

be

Quoted 1 line

stabilised for release as part of Xen 3.0.4. The interfaces discussed

below

Quoted 1 line

are still open to change, and will only be frozen when Xen 3.0.4 is

released.

Quoted 5 lines

The Xen-API work had a number of goals:

1. Support the Xen-CIM project in its development of CIM providers

for

Quoted 1 line

managing Xen-based hosts. DMTF's CIM is the accepted standard for

the

Quoted 1 line

monitoring and management of hetrogenous clusters, and the Xen-CIM

team

Quoted 1 line

are working to integrate Xen-based hosts into these environments

through

Quoted 4 lines
      the development of a CIM -> Xen bridge.

2. Encourage the development of third-party clients for managing Xen directly. For enterprise-level hetrogeneous environments, the

best

Quoted 1 line

management interface to use is CIM, but for small, simple

deployments,

Quoted 1 line

direct lightweight management may be preferred. To this end, we

wish

Quoted 1 line

to support third parties in the production of clients, by

providing

Quoted 7 lines

an interface that they can use.

3. Integrate the remote management of Xen systems, and make remote management both easy to use and secure.

To this end, the major effort for the Xen-API project has been to

provide a

Quoted 1 line

interface into Xend that is stable and can be supported in the long

term.

Quoted 1 line

This will give a solid foundation for the CIM providers, and a

guaranteed

Quoted 5 lines

interface for direct management tools.

This interface is XML-RPC based, with a data-model and message semantics layered on top. The wire-protocol will be guaranteed for the long term, ensuring that clients using it will be binary-compatible with all Xen

releases

Quoted 3 lines

after Xen 3.0.4.

As well as fixing the wire protocol, we will be providing bindings

written in

Quoted 5 lines

a number of languages, and making these available in-tree. tools/libxen contains the new C bindings to this API, and the Python clients can get up-and-running immediately with reflective bindings using xmlrpclib2.

The intention for the bindings is that they will be a thin layer on top

of the

Quoted 1 line

wire protocol and data model, with little in the way of moving parts. On

top

Quoted 2 lines

of this, we expect libraries such as RedHat's libvirt to add the richer functionality. This split allows the libraries in the Xen tree to be

stable

Quoted 1 line

and widely used, and allows third parties to innovate on top of

thatplatform.

Quoted 6 lines

Lifecycle Changes
-----------------

To manage a VM properly over its whole lifetime, Xend needs to

understand more

Quoted 1 line

about VMs than it has traditionally done. Xend used to understand VMs

only

Quoted 1 line

when they were running, receiving configuration parameters for those VMs

from

Quoted 1 line

the outside, and removing the configuration details again as soon as the

VM

Quoted 1 line

shut down. This meant that external systems were needed in order

torecord VM

Quoted 2 lines

details over the long term, such as the xendomains script. In order to properly manage VMs remotely, this has to be improved, with Xend

becoming

Quoted 1 line

responsible for tracking VM configuration even once the VM has been shut

down.

Quoted 7 lines

To this end, there are some new xm commands:

  o  xm new     - Introduces a new VM to Xend
  o  xm delete  - Removes a specified VM
  o  xm start   - Boot a named VM
  o  xm create  - Does what it always did, which now makes it equivalent 

to

Quoted 5 lines

"xm new ; xm start"
o xm suspend - Save a VM to a location under Xend's management
o xm resume - Resume a VM from that same location

xm list will report non-running VMs, if you ask it to, as well as

running

Quoted 7 lines

ones.

Authentication
--------------

Remote management needs proper authentication. At the moment, you must

run xm

Quoted 1 line

as root if you want to make any changes to the system, and that's the

only

Quoted 1 line

authentication we have. For Xen 3.0.4, Xend will be enhanced so that it

is

Quoted 1 line

able to authenticate users through PAM, giving administrators the power

to

Quoted 1 line

allow Xend operations to be performed, without giving away the root

password.

Quoted 8 lines

What We've Got
--------------

  o  Many changes to Xend (xen-unstable.hg/tools/python/xen)
  o  New C bindings to the Xen-API (xen-unstable.hg/tools/libxen)
  o  Scripts for experimenting with the Xen-API, much of which will be 

rolled

Quoted 9 lines

into xm in time (xen-unstable.hg/tools/python/scripts)
o A document describing the Xen-API (xen-unstable.hg/docs/xen-api)

What We Need
------------

o Tests for the new xm commands, through xm-test.
o Lots of people trying the new API and the new C bindings, to see

whether

Quoted 3 lines

they meet your needs.
o Implementation of the remaining API functions, in particular the network-related ones, and those on the to-do list in the

documentation.

Quoted 5 lines
  o  Documentation improvements.
  o  A Xend bug-squash.
  o  Lots of feedback!
Quoted 8 lines

Thanks, and have fun,

Ewan.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 5 lines · Stefan Berger

Hello Ewan,

something must have broken while moving the API code into the
xen-unstable repository. I can create multiple Gentoo domains using xapi.py and xapi.domcfg.py, but cannot delete any of them.

It wouldn't surprise me if there were a few breakages. What do you get in the logs?

Ewan.

#3 lore raw

[email protected] wrote on 11/06/2006 06:46:03 PM:

Quoted 10 lines · Stefan Berger
Quoted 6 lines

Hello Ewan,

something must have broken while moving the API code into the
xen-unstable repository. I can create multiple Gentoo domains using xapi.py and xapi.domcfg.py, but cannot delete any of them.

It wouldn't surprise me if there were a few breakages. What do you get in the logs?

Here's the log. I also made some modfifications to the password checking so I can just press enter twice, but that should not have effects on the domain creation.

[2006-11-07 13:46:33 xend 8500] WARNING (XendAuthSessions:27) python-pam is required for XenAPI support.
[2006-11-07 13:46:33 xend 8512] INFO (SrvDaemon:295) Xend Daemon started [2006-11-07 13:46:33 xend 8512] INFO (SrvDaemon:299) Xend changeset:
unavailable.
[2006-11-07 13:46:33 xend 8512] INFO (SrvDaemon:306) Xend version:
Unknown.
[2006-11-07 13:46:33 xend.XendDomainInfo 8512] DEBUG (XendDomainInfo:174) XendDomainInfo.recreate({'paused': 0, 'cpu_time': 1120748141145L, 'ssidref': 0, 'hvm': 0, 'shutdown_reason': 0, 'dying': 0, 'mem_kb':
595968, 'domid': 0, 'name': 'Domain-0', 'max_vcpu_id': 1, 'crashed': 0, 'running': 1, 'maxmem_kb': -4, 'shutdown': 0, 'online_vcpus': 2, 'handle':
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'blocked': 0}) [2006-11-07 13:46:33 xend 8512] DEBUG (XendConfig:299) XendConfig: {'hvm':
0, 'shutdown_reason': 0, 'paused': 0, 'crashed': 0, 'running': 1, 'maxmem_kb': -4, 'shutdown': 0, 'mem_kb': 595968, 'handle': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'blocked': 0, 'cpu_time':
1120748141145L, 'ssidref': 0, 'name': 'Domain-0', 'dying': 0, 'domid': 0, 'max_vcpu_id': 1, 'online_vcpus': 2}
[2006-11-07 13:46:33 xend.XendDomainInfo 8512] INFO (XendDomainInfo:189) Recreating domain 0, UUID 00000000-0000-0000-0000-000000000000. at /local/domain/0
[2006-11-07 13:46:33 xend 8512] DEBUG (XendDomain:389) Adding Domain: 0 [2006-11-07 13:46:33 xend 8512] DEBUG (XendDomain:348) number of vcpus to use is 0
[2006-11-07 13:46:33 xend.XendDomainInfo 8512] DEBUG (XendDomainInfo:759) XendDomainInfo.handleShutdownWatch
[2006-11-07 13:47:00 xend 8512] DEBUG (XendConfig:299) XendConfig:
{'kernel_kernel': '/boot/vmlinuz-2.6.16.29-xen', 'on_poweroff': 'destroy', 'name': 'GentooAPI', 'kernel_args': '', 'on_reboot': 'restart', 'image':
'(linux\n (kernel /boot/vmlinuz-2.6.16.29-xen)\n (ramdisk
/boot/initrd-2.6.16.29-xen.img)\n)\n', 'kernel_initrd':
'/boot/initrd-2.6.16.29-xen.img', 'on_crash': 'restart', 'vif_refs': [], 'memory': 32, 'device': {}, 'vtpm_refs': [], 'bootloader': '', 'maxmem':
32, 'vbd_refs': []}
[2006-11-07 13:47:00 xend.XendDomainInfo 8512] DEBUG (XendDomainInfo:270) XendDomainInfo.createDormant({'on_xend_stop': 'ignore', 'features': '', 'image': ['linux', ['kernel', '/boot/vmlinuz-2.6.16.29-xen'], ['ramdisk', '/boot/initrd-2.6.16.29-xen.img']], 'kernel_initrd':
'/boot/initrd-2.6.16.29-xen.img', 'cpus': [], 'vcpu_avail': 1, 'backend':
[], 'uuid': 'db5359b2-3ab2-edb2-c09c-662f1f88c828', 'kernel_args': '', 'on_reboot': 'restart', 'cpu_weight': 256, 'online_vcpus': 1, 'memory':
32, 'cpu_cap': 0, 'kernel_kernel': '/boot/vmlinuz-2.6.16.29-xen', 'on_poweroff': 'destroy', 'on_xend_start': 'ignore', 'on_crash':
'restart', 'vbd_refs': [], 'device': {}, 'bootloader': '', 'maxmem': 32, 'shadow_memory': 0, 'name': 'GentooAPI', 'bootloader_args': None, 'max_vcpu_id': 0, 'vcpus': 1, 'vif_refs': [], 'vtpm_refs': [], 'security':
[]})
[2006-11-07 13:47:00 xend 8512] DEBUG (XendConfig:299) XendConfig:
{'on_xend_stop': 'ignore', 'memory': 32, 'on_poweroff': 'destroy', 'features': '', 'image': ['linux', ['kernel', '/boot/vmlinuz-2.6.16.29-xen'], ['ramdisk', '/boot/initrd-2.6.16.29-xen.img']], 'kernel_initrd':
'/boot/initrd-2.6.16.29-xen.img', 'cpus': [], 'on_xend_start': 'ignore', 'kernel_kernel': '/boot/vmlinuz-2.6.16.29-xen', 'vbd_refs': [], 'shadow_memory': 0, 'vcpu_avail': 1, 'device': {}, 'on_crash': 'restart', 'backend': [], 'bootloader': '', 'uuid':
'db5359b2-3ab2-edb2-c09c-662f1f88c828', 'kernel_args': '', 'on_reboot':
'restart', 'bootloader_args': None, 'name': 'GentooAPI', 'max_vcpu_id': 0, 'vcpus': 1, 'cpu_weight': 256, 'vif_refs': [], 'online_vcpus': 1, 'cpu_cap': 0, 'vtpm_refs': [], 'security': [], 'maxmem': 32} [2006-11-07 13:47:00 xend 8512] DEBUG (XendDomain:616) Creating new managed domain: GentooAPI: db5359b2-3ab2-edb2-c09c-662f1f88c828

First GentooAPI domain created.

[2006-11-07 13:47:02 xend 8512] DEBUG (XendConfig:299) XendConfig:
{'kernel_kernel': '/boot/vmlinuz-2.6.16.29-xen', 'on_poweroff': 'destroy', 'name': 'GentooAPI', 'kernel_args': '', 'on_reboot': 'restart', 'image':
'(linux\n (kernel /boot/vmlinuz-2.6.16.29-xen)\n (ramdisk
/boot/initrd-2.6.16.29-xen.img)\n)\n', 'kernel_initrd':
'/boot/initrd-2.6.16.29-xen.img', 'on_crash': 'restart', 'vif_refs': [], 'memory': 32, 'device': {}, 'vtpm_refs': [], 'bootloader': '', 'maxmem':
32, 'vbd_refs': []}
[2006-11-07 13:47:02 xend.XendDomainInfo 8512] DEBUG (XendDomainInfo:270) XendDomainInfo.createDormant({'on_xend_stop': 'ignore', 'features': '', 'image': ['linux', ['kernel', '/boot/vmlinuz-2.6.16.29-xen'], ['ramdisk', '/boot/initrd-2.6.16.29-xen.img']], 'kernel_initrd':
'/boot/initrd-2.6.16.29-xen.img', 'cpus': [], 'vcpu_avail': 1, 'backend':
[], 'uuid': 'dfbab48d-c65b-6bf0-d078-b54e8eaee921', 'kernel_args': '', 'on_reboot': 'restart', 'cpu_weight': 256, 'online_vcpus': 1, 'memory':
32, 'cpu_cap': 0, 'kernel_kernel': '/boot/vmlinuz-2.6.16.29-xen', 'on_poweroff': 'destroy', 'on_xend_start': 'ignore', 'on_crash':
'restart', 'vbd_refs': [], 'device': {}, 'bootloader': '', 'maxmem': 32, 'shadow_memory': 0, 'name': 'GentooAPI', 'bootloader_args': None, 'max_vcpu_id': 0, 'vcpus': 1, 'vif_refs': [], 'vtpm_refs': [], 'security':
[]})
[2006-11-07 13:47:02 xend 8512] DEBUG (XendConfig:299) XendConfig:
{'on_xend_stop': 'ignore', 'memory': 32, 'on_poweroff': 'destroy', 'features': '', 'image': ['linux', ['kernel', '/boot/vmlinuz-2.6.16.29-xen'], ['ramdisk', '/boot/initrd-2.6.16.29-xen.img']], 'kernel_initrd':
'/boot/initrd-2.6.16.29-xen.img', 'cpus': [], 'on_xend_start': 'ignore', 'kernel_kernel': '/boot/vmlinuz-2.6.16.29-xen', 'vbd_refs': [], 'shadow_memory': 0, 'vcpu_avail': 1, 'device': {}, 'on_crash': 'restart', 'backend': [], 'bootloader': '', 'uuid':
'dfbab48d-c65b-6bf0-d078-b54e8eaee921', 'kernel_args': '', 'on_reboot':
'restart', 'bootloader_args': None, 'name': 'GentooAPI', 'max_vcpu_id': 0, 'vcpus': 1, 'cpu_weight': 256, 'vif_refs': [], 'online_vcpus': 1, 'cpu_cap': 0, 'vtpm_refs': [], 'security': [], 'maxmem': 32} [2006-11-07 13:47:02 xend 8512] DEBUG (XendDomain:616) Creating new managed domain: GentooAPI: dfbab48d-c65b-6bf0-d078-b54e8eaee921

Second GentooAPI domain created.

Stefan

Quoted 8 lines

Ewan.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Ewan Mellor

This here solves the problem.

diff -r 2408c042a276 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Nov 8
11:13:50 2006
+++ b/tools/python/xen/xend/XendDomain.py Wed Nov 8
09:58:35 2006
@@ -472,7 +472,7 @@
self.domains_lock.acquire()
try:
# lookup by name
- match = [dom for dom in self.domains.values() \

+            match = [dom for dom in self.managed_domains.values() \
                      if dom.getName() == domid]
             if match:
                 return match[0]

Stefan

[email protected] wrote on 11/06/2006 06:46:03 PM:

Quoted 11 lines · Stefan Berger
Quoted 6 lines

Hello Ewan,

something must have broken while moving the API code into the
xen-unstable repository. I can create multiple Gentoo domains using xapi.py and xapi.domcfg.py, but cannot delete any of them.

It wouldn't surprise me if there were a few breakages. What do you get in the logs?

Quoted 7 lines

Ewan.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw
Quoted 18 lines · Stefan Berger

This here solves the problem.

diff -r 2408c042a276 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Nov 8
11:13:50 2006
+++ b/tools/python/xen/xend/XendDomain.py Wed Nov 8
09:58:35 2006

(quoted diff) +1 -1
@@ -472,7 +472,7 @@
        self.domains_lock.acquire()
        try:
            # lookup by name
-            match = [dom for dom in self.domains.values() \
+            match = [dom for dom in self.managed_domains.values() \
                     if dom.getName() == domid]
            if match:
                return match[0]
Quoted 1 line

Stefan

Ah, this is essentially the xend patch I was referring to in http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00361.html. In domain_lookup_nr, it appears only 'non-inactive' domains are in the domains dictionary, so this routine would not find the inactive domain that I was attempting to destroy. I took a slightly different approach (patch attached), but given my knowledge of the code was not sure of any potential side affects. Also I wasn't sure why we are building a list only to return the first item. Why not return the item when found? I realize that names are not unique but the current code doesn't handle duplicates anyway.

Ewan, can you comment on either of these patches? This routine needs to accommodate inactive domains as well.

Regards,
Jim

tools/python/xen/xend/XendDomain.py +3 -4
diff -r 8eb8c0085604 tools/python/xen/xend/XendDomain.py
@@ -472,10 +472,9 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             # lookup by name
-            match = [dom for dom in self.domains.values() \
-                     if dom.getName() == domid]
-            if match:
-                return match[0]
+            for dom in self.domains.values() + self.managed_domains.values():
+                if dom.getName() == domid:
+                    return dom
 
             # lookup by id
             try:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw
Quoted 32 lines · Jim Fehlig
Quoted 18 lines · Stefan Berger

This here solves the problem.

diff -r 2408c042a276 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Nov 8
11:13:50 2006
+++ b/tools/python/xen/xend/XendDomain.py Wed Nov 8
09:58:35 2006

tools/python/xen/xend/XendDomain.py +1 -1
@@ -472,7 +472,7 @@
       self.domains_lock.acquire()
       try:
           # lookup by name
-            match = [dom for dom in self.domains.values() \
+            match = [dom for dom in self.managed_domains.values() \
                    if dom.getName() == domid]
           if match:
               return match[0]
Quoted 1 line

Stefan

Ah, this is essentially the xend patch I was referring to in
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00361.html.
In domain_lookup_nr, it appears only 'non-inactive' domains are in the domains dictionary, so this routine would not find the inactive domain that I was attempting to destroy. I took a slightly different approach (patch attached), but given my knowledge of the code was not sure of any potential side affects. Also I wasn't sure why we are building a list only to return the first item. Why not return the item when found? I realize that names are not unique but the current code doesn't handle duplicates anyway.

Quoted 2 lines

Ewan, can you comment on either of these patches? This routine needs to accommodate inactive domains as well.

Yes, we certainly need to include both lists here -- Stefan's patch breaks other things unfortunately. Your patch looks OK to me, though I'll give Alastair time to comment -- he's worked on this more recently than me.

Ewan.

#7 lore raw
In reply to Jim Fehlig

Jim Fehlig <[email protected]> wrote on 11/08/2006 12:34:24 PM:

Quoted 19 lines
Quoted 18 lines · Stefan Berger

This here solves the problem.

diff -r 2408c042a276 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Wed Nov 8
11:13:50 2006
+++ b/tools/python/xen/xend/XendDomain.py Wed Nov 8
09:58:35 2006

tools/python/xen/xend/XendDomain.py +1 -1
@@ -472,7 +472,7 @@
        self.domains_lock.acquire()
        try:
            # lookup by name
-            match = [dom for dom in self.domains.values() \
+            match = [dom for dom in self.managed_domains.values() \
                     if dom.getName() == domid]
            if match:
                return match[0]
Quoted 4 lines
Quoted 1 line

Stefan

Ah, this is essentially the xend patch I was referring to in

http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00361.html.

Quoted 5 lines

In domain_lookup_nr, it appears only 'non-inactive' domains are in the domains dictionary, so this routine would not find the inactive domain that I was attempting to destroy. I took a slightly different approach (patch attached), but given my knowledge of the code was not sure of any

Quoted 8 lines

potential side affects. Also I wasn't sure why we are building a list only to return the first item. Why not return the item when found? I realize that names are not unique but the current code doesn't handle duplicates anyway.

Ewan, can you comment on either of these patches? This routine needs to

accommodate inactive domains as well.

Just another comment: For me it solves the problem of restricting domain creation to only allow one domain with a certain name *and* being able to destroy the domain afterwards...

Stefan

Quoted 6 lines

Regards,
Jim

diff -r 8eb8c0085604 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py Mon Nov 06 16:36:51 2006

+0000

Quoted 1 line

+++ b/tools/python/xen/xend/XendDomain.py Wed Nov 08 10:32:26 2006

-0700

tools/python/xen/xend/XendDomain.py class XendDomain: · line 475

Quoted 9 lines
tools/python/xen/xend/XendDomain.py +1 -4
@@ -472,10 +472,9 @@ class XendDomain:
         self.domains_lock.acquire()
         try:
             # lookup by name
-            match = [dom for dom in self.domains.values() \
-                     if dom.getName() == domid]
-            if match:
-                return match[0]
+            for dom in self.domains.values() + 

self.managed_domains.values():

tools/python/xen/xend/XendDomain.py class XendDomain: · line 480

Quoted 5 lines
tools/python/xen/xend/XendDomain.py +2 -0
+                if dom.getName() == domid:
+                    return dom
 
             # lookup by id
             try:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw
In reply to Ewan Mellor
Quoted 2 lines · Ewan Mellor

o xm suspend - Save a VM to a location under Xend's management
o xm resume - Resume a VM from that same location

Does this preclude running Xen in an environment with no persistent storage? For example we now suspend to pipe which actually results in the suspend image being stored off the Xen host.

Pat

Signature · 2 lines
Patrick O'Rourke
[email protected]
#9 lore raw
Quoted 8 lines · Patrick O'Rourke
Quoted 2 lines · Ewan Mellor

o xm suspend - Save a VM to a location under Xend's management
o xm resume - Resume a VM from that same location

Does this preclude running Xen in an environment with no persistent storage? For example we now suspend to pipe which actually results in the suspend image being stored off the Xen host.

We've not taken xm save and xm restore away, so you can still use them if you know what you're doing. We're trying to encourage people not to do that, because of the non-obvious (but very real) risk to their data, but if it's integrated into a wider protective framework, then that's fine of course.

Would you like an API call that better supported this use-case? In the long run, might your integration be easier if Xend supported "save to this address/port" or something like that?

Ewan.

#10 lore raw
Quoted 3 lines · Ewan Mellor

Would you like an API call that better supported this use-case? In the long run, might your integration be easier if Xend supported "save to this address/port" or something like that?

Yes, I believe that would suit our needs.

Pat

Signature · 2 lines
Patrick O'Rourke
[email protected]