summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorjaypipes@gmail.com <>2011-03-14 13:59:41 -0400
committerjaypipes@gmail.com <>2011-03-14 13:59:41 -0400
commit8cf9e2320b0d7f4c79d910cbac1f5a0db9aa999c (patch)
tree6cb64437aec944e7210cd7a6d5a2db9723971ec8 /plugins
parent0dcd68077183c6cce60075a35be36f5c0764925b (diff)
parent7fde254ec53aeb88301e5592853961b2b9c87ef4 (diff)
Merge trunk, resolve conflicts, and rename 010_ migrate file to 011_ since another migrate file got into trunk ahead of this...
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/xenserver/networking/etc/xensource/scripts/vif_rules.py34
-rw-r--r--plugins/xenserver/xenapi/etc/xapi.d/plugins/glance11
2 files changed, 25 insertions, 20 deletions
diff --git a/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py b/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py
index d2b2d61e6..48122e6d6 100755
--- a/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py
+++ b/plugins/xenserver/networking/etc/xensource/scripts/vif_rules.py
@@ -54,6 +54,7 @@ def main(dom_id, command, only_this_vif=None):
def execute(*command, return_stdout=False):
devnull = open(os.devnull, 'w')
+ command = map(str, command)
proc = subprocess.Popen(command, close_fds=True,
stdout=subprocess.PIPE, stderr=devnull)
devnull.close()
@@ -71,13 +72,13 @@ def apply_iptables_rules(command, params):
iptables = lambda *rule: execute('/sbin/iptables', *rule)
iptables('-D', 'FORWARD', '-m', 'physdev',
- '--physdev-in', '%(VIF)s' % params,
- '-s', '%(IP)s' % params,
+ '--physdev-in', params['VIF'],
+ '-s', params['IP'],
'-j', 'ACCEPT')
if command == 'online':
iptables('-A', 'FORWARD', '-m', 'physdev',
- '--physdev-in', '%(VIF)s' % params,
- '-s', '%(IP)s' % params,
+ '--physdev-in', params['VIF'],
+ '-s', params['IP'],
'-j', 'ACCEPT')
@@ -85,25 +86,24 @@ def apply_arptables_rules(command, params):
arptables = lambda *rule: execute('/sbin/arptables', *rule)
arptables('-D', 'FORWARD', '--opcode', 'Request',
- '--in-interface', '%(VIF)s' % params,
- '--source-ip', '%(IP)s' % params,
- '--source-mac', '%(MAC)s' % params,
+ '--in-interface', params['VIF'],
+ '--source-ip', params['IP'],
+ '--source-mac', params['MAC'],
'-j', 'ACCEPT')
arptables('-D', 'FORWARD', '--opcode', 'Reply',
- '--in-interface', '%(VIF)s' % params,
- '--source-ip', '%(IP)s' % params,
- '--source-mac', '%(MAC)s' % params,
+ '--in-interface', params['VIF'],
+ '--source-ip', params['IP'],
+ '--source-mac', params['MAC'],
'-j', 'ACCEPT')
if command == 'online':
arptables('-A', 'FORWARD', '--opcode', 'Request',
- '--in-interface', '%(VIF)s' % params
- '--source-ip', '%(IP)s' % params,
- '--source-mac', '%(MAC)s' % params,
+ '--in-interface', params['VIF'],
+ '--source-mac', params['MAC'],
'-j', 'ACCEPT')
arptables('-A', 'FORWARD', '--opcode', 'Reply',
- '--in-interface', '%(VIF)s' % params,
- '--source-ip', '%(IP)s' % params,
- '--source-mac', '%(MAC)s' % params,
+ '--in-interface', params['VIF'],
+ '--source-ip', params['IP'],
+ '--source-mac', params['MAC'],
'-j', 'ACCEPT')
@@ -130,7 +130,7 @@ def apply_ebtables_rules(command, params):
'-i', params['VIF'], '-j', 'DROP')
if command == 'online':
ebtables('-I', 'FORWARD', '1', '-s', '!', params['MAC'],
- '-i', '%(VIF)s', '-j', 'DROP')
+ '-i', params['VIF'], '-j', 'DROP')
if __name__ == "__main__":
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance
index 201b99fda..c996f6ef4 100644
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance
@@ -191,7 +191,7 @@ def _prepare_staging_area_for_upload(sr_path, staging_path, vdi_uuids):
os.link(source, link_name)
-def _upload_tarball(staging_path, image_id, glance_host, glance_port):
+def _upload_tarball(staging_path, image_id, glance_host, glance_port, os_type):
"""
Create a tarball of the image and then stream that into Glance
using chunked-transfer-encoded HTTP.
@@ -215,7 +215,10 @@ def _upload_tarball(staging_path, image_id, glance_host, glance_port):
'x-image-meta-is-public': 'True',
'x-image-meta-status': 'queued',
'x-image-meta-disk-format': 'vhd',
- 'x-image-meta-container-format': 'ovf'}
+ 'x-image-meta-container-format': 'ovf',
+ 'x-image-meta-property-os-type': os_type
+ }
+
for header, value in headers.iteritems():
conn.putheader(header, value)
conn.endheaders()
@@ -337,11 +340,13 @@ def upload_vhd(session, args):
glance_host = params["glance_host"]
glance_port = params["glance_port"]
sr_path = params["sr_path"]
+ os_type = params["os_type"]
staging_path = _make_staging_area(sr_path)
try:
_prepare_staging_area_for_upload(sr_path, staging_path, vdi_uuids)
- _upload_tarball(staging_path, image_id, glance_host, glance_port)
+ _upload_tarball(staging_path, image_id, glance_host, glance_port,
+ os_type)
finally:
_cleanup_staging_area(staging_path)