Skip to contentSkip to conversation

Fix xm block/network-attach command for inactive managed domain

PATCH Masaki Kanno 1 participant 2 messages Jul 4, 2007 – Jul 5, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

When I tested xm block-attach command to a inactive managed domain, I saw the following error message. But information of the VBD was shown by xm list command.

# xm list vm1
Name                                        ID   Mem VCPUs      State   Time(s)
vm1                                              256     2                 0.0
# xm block-attach vm1 phy:/dev/hdb hdb w
Error: int argument required
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]

Create a new virtual block device.

# xm list --long vm1
(domain
 <<snip>>
    (device
        (vbd
            (uuid 9cefc28e-5c05-1fab-68c9-5834bd569bef)
            (bootable 0)
            (driver paravirtualised)
            (dev hdb)
            (uname phy:/dev/hdb)
            (mode w)
        )
    )
)

I examined xm block-attach command to remove the error message, so that I found a few problem.

1. The cause of the error message is because deviceClass.createDevice() was called for the inactive managed domain.

2. Xm network-attach command has a similar problem. The error message is as follows.
Error: (22, 'Invalid argument, while reading None/device-misc/vif/nextDeviceID')

3. After the error message, I restarted xend.
Then the attached VBD by xm block-attach command was removed from information of xm list command. I think that the cause is because managed_config_save() was not called for the managed domain when xm block-attach command was executed.

Best regards,
Kan

tools/python/xen/xend/XendDomainInfo.py +12 -3
diff -r e6d5e4709466 tools/python/xen/xend/XendDomainInfo.py
@@ -502,9 +502,18 @@ class XendDomainInfo:
         dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
         dev_config_dict = self.info['devices'][dev_uuid][1]
         log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
-        dev_config_dict['devid'] = devid = \
-             self._createDevice(dev_type, dev_config_dict)
-        self._waitForDevice(dev_type, devid)
+
+        if self.domid is not None:
+            try:
+                dev_config_dict['devid'] = devid = \
+                    self._createDevice(dev_type, dev_config_dict)
+                self._waitForDevice(dev_type, devid)
+            except VmError, ex:
+                raise ex
+        else:
+            devid = None
+
+        xen.xend.XendDomain.instance().managed_config_save(self)
         return self.getDeviceController(dev_type).sxpr(devid)
 
     def device_configure(self, dev_sxp, devid = None):

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

#1 lore raw

Re: Fix xm block/network-attach command for inactivemanaged domain

Quoted 44 lines

Hi,

When I tested xm block-attach command to a inactive managed domain, I saw the following error message. But information of the VBD was shown by xm list command.

# xm list vm1
Name                                        ID   Mem VCPUs      State   
Time(s)
vm1                                              256     2                 
0.0
# xm block-attach vm1 phy:/dev/hdb hdb w
Error: int argument required
Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain]

Create a new virtual block device.

# xm list --long vm1
(domain
<<snip>>
   (device
       (vbd
           (uuid 9cefc28e-5c05-1fab-68c9-5834bd569bef)
           (bootable 0)
           (driver paravirtualised)
           (dev hdb)
           (uname phy:/dev/hdb)
           (mode w)
       )
   )
)

I examined xm block-attach command to remove the error message, so that I found a few problem.

1. The cause of the error message is because deviceClass.createDevice() was called for the inactive managed domain.

2. Xm network-attach command has a similar problem. The error message is as follows.
Error: (22, 'Invalid argument, while reading None/device-misc/vif/
nextDeviceID')

Quoted 5 lines

3. After the error message, I restarted xend.
Then the attached VBD by xm block-attach command was removed from information of xm list command. I think that the cause is because managed_config_save() was not called for the managed domain when xm block-attach command was executed.

Oops, I forgot important explanation to you.

This patch solves the problems.
BTW, I found a few problem about xm block/network-detach command too. I'm going to fix the problems too.

Best regards,
Kan

Quoted 11 lines

Best regards,
Kan

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