Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 645664

Summary: Enable 'autostart' or disable 'autostart' doesn't take effect actually guest will auto start by self
Product: Red Hat Enterprise Linux 5 Reporter: wangyimiao <yimwang>
Component: libvirtAssignee: Daniel Veillard <veillard>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.6CC: berrange, eblake, hbrock, jdenemar, llim, tyan, virt-maint, xen-maint, yoyzhang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 589863 Environment:
Last Closed: 2010-10-22 11:30:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Jiri Denemark 2010-10-22 08:03:44 UTC
RHEL-5.6 does not support LXC. I wonder how did you get a running LXC guest to test this on.

Comment 2 wangyimiao 2010-10-22 09:23:42 UTC
Hi 'JD'

Steps to Reproduce:
#cat rhel5.xml
<domain type='qemu' id='1'>
  <name>rhel5</name>
  <uuid>87a7652e-dfdb-a618-1b43-3517f9850f4b</uuid>
  <memory>524288</memory>
  <currentMemory>524288</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel5.4.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/rhel55.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-hd0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='54:52:00:6c:8d:ae'/>
      <source network='default'/>
      <target dev='vnet0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
  </devices>
  <seclabel type='dynamic' model='selinux'>
    <label>system_u:system_r:svirt_t:s0:c464,c770</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c464,c770</imagelabel>
  </seclabel>
</domain>

1.Define and start two RHEL5 guest. 
 # virsh define rhel5.xml
 # virsh start rhel5

Domain rhel5 started

4.# virsh list --all
 Id Name                 State
----------------------------------
  6 rhel5                running

5.# virsh dominfo rhel5
Id:             1
Name:           rhel5
UUID:           87a7652e-dfdb-a618-1b43-3517f9850f4b
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       2.2s
Max memory:     524288 kB
Used memory:    524288 kB
Persistent:     yes
Autostart:      disable
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c464,c770 (enforcing)

Reboot host the guest will start automatically

5. # virsh autostart rhel5
Domain rhel5 marked as autostarted

6. # virsh dominfo rhel5
Id:             6
Name:           rhel5
UUID:           87a7652e-dfdb-a618-1b43-3517f9850f4b
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       82.9s
Max memory:     524288 kB
Used memory:    524288 kB
Persistent:     yes
Autostart:      enable
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c235,c481 (permissive)

Reboot host the guest will start automatically

Comment 3 wangyimiao 2010-10-22 09:25:55 UTC
Enable 'autostart' or not doesn't take effect actually, guest will auto start by self

Comment 4 Daniel Berrangé 2010-10-22 09:35:59 UTC
The guest was still running when you rebooted the host after step 4. Thus the libvirt-guests init script will automatically save the guest, and restore it on  boot. This is independant of autostart. If you want to test autostart, then you need to make sure the guest is *shutoff*, before rebooting.

Comment 5 Jiri Denemark 2010-10-22 11:07:12 UTC
Could you retest using correct steps?

Comment 6 wangyimiao 2010-10-22 11:30:27 UTC
Hi 'JD'

 Follow the comment 4,"shutoff" guest with "autostart" will be autostart after host backup.I will closed this bug as not a bug.

 Thanks!