[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] virsh start problem + patch



Hello!

I've been trying to use virsh to manage my Xen domains on Fedora 8.

I found that I am unable to start any xen managed domains from virsh,
because virsh complains that 'Domain is already running'.
Actually, I am able to start them once, but once they are stopped, they
are impossible to re-start.
steps to reprouce:
1. use virt-install to install HVM domain
2. virsh start domain
3. shut down the domain from within the guest (i.e. Start-> shutdown)
4. virsh start domain -> error

The problem appears with stock F8 (with current updates),  but I've also
tried the same with libvirt 4.1, with the same results.

I've looked into the virsh code, and it seems that it was written with
only only old-style xen in mind, and xen 3.1's managed domains break the
logic.

I've attached a simple patch against 0.4.1 that checks the actual domain
state, instead of simply checking if libvirt knows about the domain.

I have experienced a similar problem with virt-manager 0.5.3, where
virt-manager is stuck showing 'running' status even after a domain has
been shut down,
hence it is not able to start the domain.

regards
István Tóth


*** libvirt-0.4.1/src/virsh.c	2008-02-28 12:16:21.000000000 +0100
--- workspace/libvirt/src/virsh.c	2008-03-08 08:37:47.000000000 +0100
***************
*** 1017,1022 ****
--- 1017,1024 ----
  cmdStart(vshControl * ctl, vshCmd * cmd)
  {
      virDomainPtr dom;
+     virDomainInfo info;
+     
      int ret = TRUE;
  
      if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
***************
*** 1026,1035 ****
--- 1028,1043 ----
          return FALSE;
  
      if (virDomainGetID(dom) != (unsigned int)-1) {
+        	if(virDomainGetInfo(dom, &info)) {
+        		if(info.state == VIR_DOMAIN_RUNNING 
+        				|| info.state == VIR_DOMAIN_BLOCKED  
+        				|| info.state == VIR_DOMAIN_PAUSED){
  		        vshError(ctl, FALSE, "%s", _("Domain is already active"));
  		        virDomainFree(dom);
  		        return FALSE;
  	        }
+        	}
+     }
  
      if (virDomainCreate(dom) == 0) {
          vshPrint(ctl, _("Domain %s started\n"),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]