Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 597790 - virsh problem: No way to pass disk format type (ie GPT) to pool-define-as nor pool-create-as
virsh problem: No way to pass disk format type (ie GPT) to pool-define-as nor...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Daniel Veillard
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-30 10:20 EDT by Justin Clift
Modified: 2010-11-11 09:50 EST (History)
8 users (show)

See Also:
Fixed In Version: libvirt-0_8_1-12_el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-11-11 09:50:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to tools/virsh.c to support --source-format option (1.76 KB, patch)
2010-05-30 10:20 EDT, 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 10:21 EDT, Justin Clift
no flags Details | Diff

  None (edit)
Description Justin Clift 2010-05-30 10:20:55 EDT
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 10:21:34 EDT
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 12:22:37 EDT
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-29 22:13:14 EDT
libvirt-0_8_1-12_el6 has been built in RHEL-6-candidate with the fix.

Dave
Comment 8 dyuan 2010-07-01 04:07:25 EDT
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 04:08:25 EDT
# 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 02:55:53 EDT
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 09:50:44 EST
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.