Bug 870078

Summary: Deltacloud RHEVM client needs to Base64-decode user_data when vmpayload is used
Product: [Retired] CloudForms Cloud Engine Reporter: Ronelle Landy <rlandy>
Component: deltacloud-coreAssignee: Michal Fojtik <mfojtik>
Status: CLOSED EOL QA Contact: Ronelle Landy <rlandy>
Severity: medium Docs Contact:
Priority: high    
Version: 1.1.0CC: cpelland, dajohnso, morazi
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 878084    
Attachments:
Description Flags
A patch for deltacloud-core 0.5.0 none

Description Ronelle Landy 2012-10-25 14:17:43 UTC
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 14:26:24 UTC
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 16:53:17 UTC
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