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
|
||||
# backend node name not available through xenapi :(
|
||||
p = subprocess.Popen (["xenstore-read",
|
||||
"/local/domain/0/backend/vbd/{0}/51712/node".format(self.get_xid())],
|
||||
stdout=subprocess.PIPE)
|
||||
used_dmdev = p.communicate()[0].strip()
|
||||
used_dmdev = xs.read('', "/local/domain/0/backend/vbd/{0}/51712/node".format(self.get_xid()))
|
||||
|
||||
return used_dmdev != current_dmdev
|
||||
|
||||
@ -1356,10 +1353,7 @@ class QubesNetVm(QubesVm):
|
||||
return
|
||||
|
||||
super(QubesNetVm, self).create_xenstore_entries(xid)
|
||||
retcode = subprocess.check_call ([
|
||||
"/usr/bin/xenstore-write",
|
||||
"/local/domain/{0}/qubes_netvm_external_ip".format(xid),
|
||||
""])
|
||||
xs.write('', "/local/domain/{0}/qubes_netvm_external_ip".format(xid), '')
|
||||
self.update_external_ip_permissions(xid)
|
||||
|
||||
def update_external_ip_permissions(self, xid = -1):
|
||||
@ -1453,24 +1447,19 @@ class QubesProxyVm(QubesNetVm):
|
||||
return
|
||||
|
||||
super(QubesProxyVm, self).create_xenstore_entries(xid)
|
||||
retcode = subprocess.check_call ([
|
||||
"/usr/bin/xenstore-write",
|
||||
"/local/domain/{0}/qubes_iptables_error".format(xid),
|
||||
""])
|
||||
retcode = subprocess.check_call ([
|
||||
"/usr/bin/xenstore-chmod",
|
||||
"/local/domain/{0}/qubes_iptables_error".format(xid),
|
||||
"r{0}".format(xid), "w{0}".format(xid)])
|
||||
xs_trans = xs.start_transaction()
|
||||
xs.write(xs_trans, "/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 }])
|
||||
xs.end_transaction(xs_trans)
|
||||
self.write_iptables_xenstore_entry()
|
||||
|
||||
def write_netvm_domid_entry(self, xid = -1):
|
||||
if xid < 0:
|
||||
xid = self.get_xid()
|
||||
|
||||
return subprocess.check_call ([
|
||||
"/usr/bin/xenstore-write", "--",
|
||||
"/local/domain/{0}/qubes_netvm_domid".format(xid),
|
||||
"{0}".format(self.netvm_vm.get_xid())])
|
||||
xs.write('', "/local/domain/{0}/qubes_netvm_domid".format(xid),
|
||||
"{0}".format(self.netvm_vm.get_xid()))
|
||||
|
||||
def write_iptables_xenstore_entry(self):
|
||||
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.rules_applied = None
|
||||
return subprocess.check_call ([
|
||||
"/usr/bin/xenstore-write",
|
||||
"/local/domain/{0}/qubes_iptables".format(self.get_xid()),
|
||||
iptables])
|
||||
xs.write('', "/local/domain/{0}/qubes_iptables".format(self.get_xid()), iptables)
|
||||
|
||||
def get_xml_attrs(self):
|
||||
attrs = super(QubesProxyVm, self).get_xml_attrs()
|
||||
|
Loading…
Reference in New Issue
Block a user