Bug 597790 - virsh problem: No way to pass disk format type (ie GPT) to pool-define-as nor pool-create-as
Summary: virsh problem: No way to pass disk format type (ie GPT) to pool-define-as nor...
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-05-30 14:20 UTC by Justin Clift
Modified: 2010-11-11 14:50 UTC (History)
8 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2010-11-11 14:50:44 UTC


Attachments (Terms of Use)
Patch to tools/virsh.c to support --source-format option (1.76 KB, patch)
2010-05-30 14:20 UTC, Justin Clift
no flags Details | Diff
Patch for the virsh man page, adding the new --source-format option (1.00 KB, patch)
2010-05-30 14:21 UTC, Justin Clift
no flags Details | Diff

Description Justin Clift 2010-05-30 14:20:55 UTC
Created attachment 418034 [details]
Patch to tools/virsh.c to support --source-format option

Description of problem:

The "pool-define-as" and "pool-create-as" commands in virsh are missing an option to specify the format of the source.

  i.e. to tell virsh that the source is using an GPT partition table, or
       an msdos one, etc.

This means that these commands can't be used for creating dedicated disk storage pools without hand editing the generated XML.  Makes it more difficult that it needs to be for writing docs (ie the Virtualization Guide), and the end users that need to learn this stuff. ;)


Version-Release number of selected component (if applicable):

libvirt-0.7.6-2.el6.x86_64
(plus also libvirt git master as of 2010-05-30)


How reproducible:

Every time.


Steps to Reproduce:
1. Create a test pool "testpool" using pool-define-as

   # virsh pool-define-as testpool disk - - "/dev/sdb" - /dev
   Pool testpool created

   #

  
Actual results:

As there is no way to pass the partition table type (ie GPT), the generated XML is wrong.  The example above generates:

# virsh pool-dumpxml testpool
  <pool type='disk'>
    <name>testpool</name>
    <uuid>7d49b144-7142-0741-3985-5215df7454fb</uuid>
    <capacity>0</capacity>
    <allocation>0</allocation>
    <available>0</available>
    <source>
      <device path='/dev/sdb'/>
      <format type='unknown'/>           <--- the problem is here
    </source>
    <target>
      <path>/dev</path>
      <permissions>
        <mode>0700</mode>
        <owner>0</owner>
        <group>0</group>
      </permissions>
    </target>
  </pool>

#


Expected results:

Being able to pass the partition table type, so the generated XML is correct.  The attached patches (one for virsh, one for its man page), adds a new "--source-format <partition type>" option to the pool-define-as and pool-create-as commands.

# virsh pool-define-as testpool disk - - "/dev/sdb" - /dev --source-format gpt
Pool testpool defined

# virsh pool-dumpxml testpool
<pool type='disk'>
  <name>testpool</name>
  <uuid>5ca7b852-4f1f-c51c-48ef-e1f6a5cdd9c1</uuid>
  <capacity>0</capacity>
  <allocation>0</allocation>
  <available>0</available>
  <source>
    <device path='/dev/sdb'/>
    <format type='gpt'/>          <--- the problem is fixed
  </source>
  <target>
    <path>/dev</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-start testpool
Pool testpool started

# virsh vol-create-as testpool volume1 20G
Vol volume1 created

# virsh vol-list testpool
Name                 Path                                    
-----------------------------------------
volume1              /dev/sdb1                             

#


Additional info:

These patches are also being submitted upstream as well.

Creating this bug for tracking purposes.

Comment 1 Justin Clift 2010-05-30 14:21:34 UTC
Created attachment 418036 [details]
Patch for the virsh man page, adding the new --source-format option

Comment 4 RHEL Product and Program Management 2010-06-02 16:22:37 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 7 Dave Allan 2010-06-30 02:13:14 UTC
libvirt-0_8_1-12_el6 has been built in RHEL-6-candidate with the fix.

Dave

Comment 8 dyuan 2010-07-01 08:07:25 UTC
Verified PASSED with libvirt-0.8.1-13.el6.

# virsh pool-define-as --print-xml sda11 --type disk --source-dev /dev/sda11 --target /mnt/test --source-format gpt
<pool type='disk'>
  <name>sda11</name>
  <source>
    <device path='/dev/sda11'/>
    <format type='gpt'/>
  </source>
  <target>
    <path>/mnt/test</path>
  </target>
</pool>

# virsh pool-define-as sda11 --type disk --source-dev /dev/sda11 --target /mnt/test --source-format gpt
Pool sda11 defined

# virsh pool-dumpxml sda11
<pool type='disk'>
  <name>sda11</name>
  <uuid>f377a609-bd42-da55-3858-e13421502434</uuid>
  <capacity>0</capacity>
  <allocation>0</allocation>
  <available>0</available>
  <source>
    <device path='/dev/sda11'/>
    <format type='gpt'/>
  </source>
  <target>
    <path>/mnt/test</path>
    <permissions>
      <mode>0700</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Comment 9 dyuan 2010-07-01 08:08:25 UTC
# virsh pool-create-as sda11 --type disk --source-dev /dev/sda11 --target /mnt/test --source-format gpt
Pool sda11 created

# virsh pool-dumpxml sda11
<pool type='disk'>
  <name>sda11</name>
  <uuid>b6187d87-b157-f71e-b48d-db702a3c78ad</uuid>
  <capacity>31445245440</capacity>
  <allocation>0</allocation>
  <available>31445213184</available>
  <source>
    <device path='/dev/sda11'>
    <freeExtent start='32256' end='31445245440'/>
    </device>
    <format type='gpt'/>
  </source>
  <target>
    <path>/mnt/test</path>
    <permissions>
      <mode>0700</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Comment 11 xhu 2010-09-08 06:55:53 UTC
Verified this bug with RHEL6 RC build and it passed:
libvirt-0.8.1-27.el6.x86_64
qemu-kvm-0.12.1.2-2.113.el6.x86_64
kernel-2.6.32-71.el6.x86_64

Comment 12 releng-rhel@redhat.com 2010-11-11 14:50:44 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.