2 format command output
source | link

my devices xml define:

first vm only has a root volume,

<disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/70395cacf62e49ec95246a919d449f64'/>
      <backingStore type='block' index='1'>
        <format type='qcow2'/>
        <source dev='/dev/967b07c5ca8f429b9647785e942cbb4b/ce7774f0634a4d098a8d4e37838f4b6f'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>

then I hot plug two disks on scsi.

<disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/6d38ee3091f64ca2bcb47b9dbd3c5901'/>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <wwn>0x000fefc4071262fb</wwn>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/b1dcd7497e544284aba954b52ffc4754'/>
      <backingStore/>
      <target dev='sdd' bus='scsi'/>
      <wwn>0x000f0683ab0ad875</wwn>
      <alias name='scsi0-0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>

the device name order in guest vm match the plug order: separate by disk size.

Disk /dev/sda: 6 MB, 6291456 bytes
1 heads, 12 sectors/track, 1024 cylinders
Units = cylinders of 12 * 512 = 6144 bytes
.
Disk /dev/sdb: 7 MB, 7340032 bytes
1 heads, 14 sectors/track, 1024 cylinders
Units = cylinders of 14 * 512 = 7168 bytes

But after reboot vm by virsh, the disk name ordering is reversed. xml define is not changed. how can I fix the devices name ordering?

my devices xml define:

first vm only has a root volume,

<disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/70395cacf62e49ec95246a919d449f64'/>
      <backingStore type='block' index='1'>
        <format type='qcow2'/>
        <source dev='/dev/967b07c5ca8f429b9647785e942cbb4b/ce7774f0634a4d098a8d4e37838f4b6f'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>

then I hot plug two disks on scsi.

<disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/6d38ee3091f64ca2bcb47b9dbd3c5901'/>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <wwn>0x000fefc4071262fb</wwn>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/b1dcd7497e544284aba954b52ffc4754'/>
      <backingStore/>
      <target dev='sdd' bus='scsi'/>
      <wwn>0x000f0683ab0ad875</wwn>
      <alias name='scsi0-0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>

the device name order in guest vm match the plug order: separate by disk size.

Disk /dev/sda: 6 MB, 6291456 bytes
1 heads, 12 sectors/track, 1024 cylinders
Units = cylinders of 12 * 512 = 6144 bytes
.
Disk /dev/sdb: 7 MB, 7340032 bytes
1 heads, 14 sectors/track, 1024 cylinders
Units = cylinders of 14 * 512 = 7168 bytes

But after reboot vm by virsh, the disk name ordering is reversed. xml define is not changed. how can I fix the devices name ordering?

my devices xml define:

first vm only has a root volume,

<disk type='file' device='disk' snapshot='external'>
  <driver name='qemu' type='qcow2' cache='none'/>
  <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/70395cacf62e49ec95246a919d449f64'/>
  <backingStore type='block' index='1'>
    <format type='qcow2'/>
    <source dev='/dev/967b07c5ca8f429b9647785e942cbb4b/ce7774f0634a4d098a8d4e37838f4b6f'/>
    <backingStore/>
  </backingStore>
  <target dev='vda' bus='virtio'/>
  <boot order='1'/>
  <alias name='virtio-disk0'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</disk>

then I hot plug two disks on scsi.

<disk type='file' device='disk' snapshot='external'>
  <driver name='qemu' type='qcow2' cache='none'/>
  <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/6d38ee3091f64ca2bcb47b9dbd3c5901'/>
  <backingStore/>
  <target dev='sdb' bus='scsi'/>
  <wwn>0x000fefc4071262fb</wwn>
  <alias name='scsi0-0-0-1'/>
  <address type='drive' controller='0' bus='0' target='0' unit='1'/>
</disk>
<disk type='file' device='disk' snapshot='external'>
  <driver name='qemu' type='qcow2' cache='none'/>
  <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/b1dcd7497e544284aba954b52ffc4754'/>
  <backingStore/>
  <target dev='sdd' bus='scsi'/>
  <wwn>0x000f0683ab0ad875</wwn>
  <alias name='scsi0-0-0-2'/>
  <address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>

the device name order in guest vm match the plug order: separate by disk size.

Disk /dev/sda: 6 MB, 6291456 bytes
1 heads, 12 sectors/track, 1024 cylinders
Units = cylinders of 12 * 512 = 6144 bytes
.
Disk /dev/sdb: 7 MB, 7340032 bytes
1 heads, 14 sectors/track, 1024 cylinders
Units = cylinders of 14 * 512 = 7168 bytes

But after reboot vm by virsh, the disk name ordering is reversed. xml define is not changed. how can I fix the devices name ordering?

1
source | link

how to fix the devices name ordering in guest vm (devices name ordering changed after reboot vm by virsh)

my devices xml define:

first vm only has a root volume,

<disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/70395cacf62e49ec95246a919d449f64'/>
      <backingStore type='block' index='1'>
        <format type='qcow2'/>
        <source dev='/dev/967b07c5ca8f429b9647785e942cbb4b/ce7774f0634a4d098a8d4e37838f4b6f'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>

then I hot plug two disks on scsi.

<disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/6d38ee3091f64ca2bcb47b9dbd3c5901'/>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <wwn>0x000fefc4071262fb</wwn>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk' snapshot='external'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/dev/967b07c5ca8f429b9647785e942cbb4b/b1dcd7497e544284aba954b52ffc4754'/>
      <backingStore/>
      <target dev='sdd' bus='scsi'/>
      <wwn>0x000f0683ab0ad875</wwn>
      <alias name='scsi0-0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>

the device name order in guest vm match the plug order: separate by disk size.

Disk /dev/sda: 6 MB, 6291456 bytes
1 heads, 12 sectors/track, 1024 cylinders
Units = cylinders of 12 * 512 = 6144 bytes
.
Disk /dev/sdb: 7 MB, 7340032 bytes
1 heads, 14 sectors/track, 1024 cylinders
Units = cylinders of 14 * 512 = 7168 bytes

But after reboot vm by virsh, the disk name ordering is reversed. xml define is not changed. how can I fix the devices name ordering?