dom0: use xen.lowlevel.xs instead of call xenstore-*
This commit is contained in:
parent
9ce2f440c3
commit
d3e6e3dec0
@ -524,10 +524,7 @@ class QubesVm(object):
|
|||||||
|
|
||||||
# Don't know why, but 51712 is xvda
|
# Don't know why, but 51712 is xvda
|
||||||
# backend node name not available through xenapi :(
|
# backend node name not available through xenapi :(
|
||||||
p = subprocess.Popen (["xenstore-read",
|
used_dmdev = xs.read('', "/local/domain/0/backend/vbd/{0}/51712/node".format(self.get_xid()))
|
||||||
"/local/domain/0/backend/vbd/{0}/51712/node".format(self.get_xid())],
|
|
||||||
stdout=subprocess.PIPE)
|
|
||||||
used_dmdev = p.communicate()[0].strip()
|
|
||||||
|
|
||||||
return used_dmdev != current_dmdev
|
return used_dmdev != current_dmdev
|
||||||
|
|
||||||
@ -1356,10 +1353,7 @@ class QubesNetVm(QubesVm):
|
|||||||
return
|
return
|
||||||
|
|
||||||
super(QubesNetVm, self).create_xenstore_entries(xid)
|
super(QubesNetVm, self).create_xenstore_entries(xid)
|
||||||
retcode = subprocess.check_call ([
|
xs.write('', "/local/domain/{0}/qubes_netvm_external_ip".format(xid), '')
|
||||||
"/usr/bin/xenstore-write",
|
|
||||||
"/local/domain/{0}/qubes_netvm_external_ip".format(xid),
|
|
||||||
""])
|
|
||||||
self.update_external_ip_permissions(xid)
|
self.update_external_ip_permissions(xid)
|
||||||
|
|
||||||
def update_external_ip_permissions(self, xid = -1):
|
def update_external_ip_permissions(self, xid = -1):
|
||||||
@ -1453,24 +1447,19 @@ class QubesProxyVm(QubesNetVm):
|
|||||||
return
|
return
|
||||||
|
|
||||||
super(QubesProxyVm, self).create_xenstore_entries(xid)
|
super(QubesProxyVm, self).create_xenstore_entries(xid)
|
||||||
retcode = subprocess.check_call ([
|
xs_trans = xs.start_transaction()
|
||||||
"/usr/bin/xenstore-write",
|
xs.write(xs_trans, "/local/domain/{0}/qubes_iptables_error".format(xid), '')
|
||||||
"/local/domain/{0}/qubes_iptables_error".format(xid),
|
xs.set_permissions(xs_trans, "/local/domain/{0}/qubes_iptables_error".format(xid),
|
||||||
""])
|
[{ 'dom': xid, 'write': True }])
|
||||||
retcode = subprocess.check_call ([
|
xs.end_transaction(xs_trans)
|
||||||
"/usr/bin/xenstore-chmod",
|
|
||||||
"/local/domain/{0}/qubes_iptables_error".format(xid),
|
|
||||||
"r{0}".format(xid), "w{0}".format(xid)])
|
|
||||||
self.write_iptables_xenstore_entry()
|
self.write_iptables_xenstore_entry()
|
||||||
|
|
||||||
def write_netvm_domid_entry(self, xid = -1):
|
def write_netvm_domid_entry(self, xid = -1):
|
||||||
if xid < 0:
|
if xid < 0:
|
||||||
xid = self.get_xid()
|
xid = self.get_xid()
|
||||||
|
|
||||||
return subprocess.check_call ([
|
xs.write('', "/local/domain/{0}/qubes_netvm_domid".format(xid),
|
||||||
"/usr/bin/xenstore-write", "--",
|
"{0}".format(self.netvm_vm.get_xid()))
|
||||||
"/local/domain/{0}/qubes_netvm_domid".format(xid),
|
|
||||||
"{0}".format(self.netvm_vm.get_xid())])
|
|
||||||
|
|
||||||
def write_iptables_xenstore_entry(self):
|
def write_iptables_xenstore_entry(self):
|
||||||
iptables = "# Generated by Qubes Core on {0}\n".format(datetime.now().ctime())
|
iptables = "# Generated by Qubes Core on {0}\n".format(datetime.now().ctime())
|
||||||
@ -1545,10 +1534,7 @@ class QubesProxyVm(QubesNetVm):
|
|||||||
self.write_netvm_domid_entry()
|
self.write_netvm_domid_entry()
|
||||||
|
|
||||||
self.rules_applied = None
|
self.rules_applied = None
|
||||||
return subprocess.check_call ([
|
xs.write('', "/local/domain/{0}/qubes_iptables".format(self.get_xid()), iptables)
|
||||||
"/usr/bin/xenstore-write",
|
|
||||||
"/local/domain/{0}/qubes_iptables".format(self.get_xid()),
|
|
||||||
iptables])
|
|
||||||
|
|
||||||
def get_xml_attrs(self):
|
def get_xml_attrs(self):
|
||||||
attrs = super(QubesProxyVm, self).get_xml_attrs()
|
attrs = super(QubesProxyVm, self).get_xml_attrs()
|
||||||
|
Loading…
Reference in New Issue
Block a user