Bug 870078 - Deltacloud RHEVM client needs to Base64-decode user_data when vmpayload is used
Deltacloud RHEVM client needs to Base64-decode user_data when vmpayload is used
Status: MODIFIED
Product: CloudForms Cloud Engine
Classification: Red Hat
Component: deltacloud-core (Show other bugs)
1.1.0
Unspecified Unspecified
high Severity medium
: rc
: ---
Assigned To: Michal Fojtik
Ronelle Landy
: ZStream
Depends On:
Blocks: 878084
  Show dependency treegraph
 
Reported: 2012-10-25 10:17 EDT by Ronelle Landy
Modified: 2012-11-27 13:01 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 878084 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
A patch for deltacloud-core 0.5.0 (3.44 KB, patch)
2012-10-25 10:26 EDT, Michal Fojtik
no flags Details | Diff

  None (edit)
Description Ronelle Landy 2012-10-25 10:17:43 EDT
Description of problem:

Following from BZ-868311 ... for RHEVM 3.1 and onwards, vmpayload will be used as the mechanism to do user data injection for RHEVM. When the floppyinject hook was used, this hook included functionality to Base64-decode the user data. Now that vmpayload will be used, the decode functionality need to move to the Deltacloud RHEVM client code.
	
Michal Fojtik already has a patch in place for this.


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

 - RHEVM 3.1
 - Conductor 1.1.1 and upwards
 - Deltacloud 0.5.0 (backported) and Deltacloud 1.0.x 

How reproducible:


Steps to Reproduce:
1. Set up a RHEVM 3.1 provider without the floppyinject hook installed
2. Create an instance with user_data using the Deltacloud Ruby client
3. Start the instance
4. ssh to the instance
5. >> /sbin/modprobe floppy; lsmod | grep floppy
   >>  /bin/mount /dev/fd0 /media; cat /media/deltacloud-user-data.txt

  
Actual results:
Without the decode step in /drivers/rhevm/rhevm_client.rb, the user_data is encoded - ie; encode once more from the time that the data was passed to the create_instance command

Expected results:

Data should be available on the RHEVM vm in the same state of encoding as it was passed to client.


Additional info:
Comment 1 Michal Fojtik 2012-10-25 10:26:24 EDT
Created attachment 633351 [details]
A patch for deltacloud-core 0.5.0

This patch is extending the Deltacloud API 0.5.0 to support the new RHEV-M 3.1 VMPayload feature:

The logic behid this patch is:

1. If RHEV-M is version 3.x
  2a) If 'x' is >= 1 then force VMPayload injection using floppy
  2b) If 'x' is == 0 then use the floppyhook injection if it is available

Because floppyinject hook do a Base64 decode for the user injected data before writing those data
into file in floppy, the VMPayload need to decode encoded data in the driver. It means that client
should **always** send a Base64 encoded data when using the 'user_data' feature in DC
Comment 3 Ronelle Landy 2012-10-25 12:53:17 EDT
Tested the attached patch on:

-----------------------

Deltacloud -0.5.0
RHEVM 3.1
No floppyinject hook installed

 /sbin/modprobe floppy; lsmod | grep floppy
floppy                 61575  0 
[root@10-16-120-187 ~]# /bin/mount /dev/fd0 /media; cat /media/deltacloud-user-data.txt
mount: block device /dev/fd0 is write-protected, mounting read-only
<correct user_data returned>

-------------------------

Deltacloud -0.5.0
RHEVM 3.0
floppyinject hook installed

/sbin/modprobe floppy; lsmod | grep floppy
floppy                 61511  0 
[root@10-16-120-245 ~]# /bin/mount /dev/fd0 /media; cat /media/deltacloud-user-data.txt
<correct user_data returned>

----------------------------

The two instance above where created using the Deltacloud Ruby client /rhevm_client.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb

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